forked from qt-creator/qt-creator
StatusBarWidget instead of IView, get rid of one level of abstraction.
Merge IView and BaseView into a single class StatusBarWidget.
This commit is contained in:
@@ -56,7 +56,7 @@ SOURCES += mainwindow.cpp \
|
|||||||
scriptmanager/scriptmanager.cpp \
|
scriptmanager/scriptmanager.cpp \
|
||||||
scriptmanager/qworkbench_wrapper.cpp \
|
scriptmanager/qworkbench_wrapper.cpp \
|
||||||
basemode.cpp \
|
basemode.cpp \
|
||||||
baseview.cpp \
|
statusbarwidget.cpp \
|
||||||
coreplugin.cpp \
|
coreplugin.cpp \
|
||||||
variablemanager.cpp \
|
variablemanager.cpp \
|
||||||
modemanager.cpp \
|
modemanager.cpp \
|
||||||
@@ -128,7 +128,6 @@ HEADERS += mainwindow.h \
|
|||||||
ioutputpane.h \
|
ioutputpane.h \
|
||||||
coreconstants.h \
|
coreconstants.h \
|
||||||
iversioncontrol.h \
|
iversioncontrol.h \
|
||||||
iview.h \
|
|
||||||
ifilewizardextension.h \
|
ifilewizardextension.h \
|
||||||
icorelistener.h \
|
icorelistener.h \
|
||||||
versiondialog.h \
|
versiondialog.h \
|
||||||
@@ -138,7 +137,7 @@ HEADERS += mainwindow.h \
|
|||||||
scriptmanager/scriptmanager_p.h \
|
scriptmanager/scriptmanager_p.h \
|
||||||
core_global.h \
|
core_global.h \
|
||||||
basemode.h \
|
basemode.h \
|
||||||
baseview.h \
|
statusbarwidget.h \
|
||||||
coreplugin.h \
|
coreplugin.h \
|
||||||
variablemanager.h \
|
variablemanager.h \
|
||||||
modemanager.h \
|
modemanager.h \
|
||||||
|
@@ -46,7 +46,6 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||||
#include <coreplugin/baseview.h>
|
|
||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
#include <coreplugin/settingsdatabase.h>
|
#include <coreplugin/settingsdatabase.h>
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <coreplugin/variablemanager.h>
|
||||||
@@ -164,7 +163,6 @@ struct EditorManagerPrivate {
|
|||||||
QAction *m_gotoOtherSplitAction;
|
QAction *m_gotoOtherSplitAction;
|
||||||
|
|
||||||
Internal::OpenEditorsWindow *m_windowPopup;
|
Internal::OpenEditorsWindow *m_windowPopup;
|
||||||
Core::BaseView *m_openEditorsView;
|
|
||||||
Internal::EditorClosingCoreListener *m_coreListener;
|
Internal::EditorClosingCoreListener *m_coreListener;
|
||||||
|
|
||||||
QMap<QString, QVariant> m_editorStates;
|
QMap<QString, QVariant> m_editorStates;
|
||||||
|
@@ -1,54 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** Commercial Usage
|
|
||||||
**
|
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
||||||
** accordance with the Qt Commercial License Agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, 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.
|
|
||||||
**
|
|
||||||
** If you are unsure which license is appropriate for your use, please
|
|
||||||
** contact the sales department at http://qt.nokia.com/contact.
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef IVIEW_H
|
|
||||||
#define IVIEW_H
|
|
||||||
|
|
||||||
#include "core_global.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
|
|
||||||
class CORE_EXPORT IView : public IContext
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum ViewPosition { First=0, Second=1, Third=2 };
|
|
||||||
|
|
||||||
IView(QObject *parent = 0) : IContext(parent) {}
|
|
||||||
virtual ~IView() {}
|
|
||||||
|
|
||||||
virtual const char *uniqueViewName() const = 0;
|
|
||||||
virtual ViewPosition defaultPosition() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Core
|
|
||||||
|
|
||||||
#endif // IVIEW_H
|
|
@@ -60,7 +60,7 @@
|
|||||||
#include "navigationwidget.h"
|
#include "navigationwidget.h"
|
||||||
#include "rightpane.h"
|
#include "rightpane.h"
|
||||||
#include "editormanager/ieditorfactory.h"
|
#include "editormanager/ieditorfactory.h"
|
||||||
#include "baseview.h"
|
#include "statusbarwidget.h"
|
||||||
#include "basefilewizard.h"
|
#include "basefilewizard.h"
|
||||||
#include "ioutputpane.h"
|
#include "ioutputpane.h"
|
||||||
|
|
||||||
@@ -323,10 +323,9 @@ bool MainWindow::init(QString *errorMessage)
|
|||||||
|
|
||||||
// Add widget to the bottom, we create the view here instead of inside the
|
// Add widget to the bottom, we create the view here instead of inside the
|
||||||
// OutputPaneManager, since the ViewManager needs to be initilized before
|
// OutputPaneManager, since the ViewManager needs to be initilized before
|
||||||
m_outputView = new Core::BaseView;
|
m_outputView = new Core::StatusBarWidget;
|
||||||
m_outputView->setUniqueViewName("OutputWindow");
|
|
||||||
m_outputView->setWidget(OutputPaneManager::instance()->buttonsWidget());
|
m_outputView->setWidget(OutputPaneManager::instance()->buttonsWidget());
|
||||||
m_outputView->setDefaultPosition(Core::IView::Second);
|
m_outputView->setPosition(Core::StatusBarWidget::Second);
|
||||||
pm->addObject(m_outputView);
|
pm->addObject(m_outputView);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@ namespace Core {
|
|||||||
|
|
||||||
class ActionManager;
|
class ActionManager;
|
||||||
class BaseMode;
|
class BaseMode;
|
||||||
class BaseView;
|
class StatusBarWidget;
|
||||||
class EditorManager;
|
class EditorManager;
|
||||||
class FileManager;
|
class FileManager;
|
||||||
class IContext;
|
class IContext;
|
||||||
@@ -195,7 +195,7 @@ private:
|
|||||||
FancyTabWidget *m_modeStack;
|
FancyTabWidget *m_modeStack;
|
||||||
NavigationWidget *m_navigationWidget;
|
NavigationWidget *m_navigationWidget;
|
||||||
RightPaneWidget *m_rightPaneWidget;
|
RightPaneWidget *m_rightPaneWidget;
|
||||||
Core::BaseView *m_outputView;
|
Core::StatusBarWidget *m_outputView;
|
||||||
VersionDialog *m_versionDialog;
|
VersionDialog *m_versionDialog;
|
||||||
|
|
||||||
IContext * m_activeContext;
|
IContext * m_activeContext;
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "progressmanager_p.h"
|
#include "progressmanager_p.h"
|
||||||
#include "progressview.h"
|
#include "progressview.h"
|
||||||
#include "baseview.h"
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include "uniqueidmanager.h"
|
#include "uniqueidmanager.h"
|
||||||
|
@@ -27,65 +27,53 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "baseview.h"
|
#include "statusbarwidget.h"
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
BaseView::BaseView(QObject *parent)
|
StatusBarWidget::StatusBarWidget(QObject *parent)
|
||||||
: IView(parent),
|
: IContext(parent),
|
||||||
m_viewName(""),
|
|
||||||
m_widget(0),
|
m_widget(0),
|
||||||
m_context(QList<int>()),
|
m_context(QList<int>()),
|
||||||
m_defaultPosition(IView::First)
|
m_defaultPosition(StatusBarWidget::First)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseView::~BaseView()
|
StatusBarWidget::~StatusBarWidget()
|
||||||
{
|
{
|
||||||
delete m_widget;
|
delete m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> BaseView::context() const
|
QList<int> StatusBarWidget::context() const
|
||||||
{
|
{
|
||||||
return m_context;
|
return m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *BaseView::widget()
|
QWidget *StatusBarWidget::widget()
|
||||||
{
|
{
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *BaseView::uniqueViewName() const
|
StatusBarWidget::StatusBarPosition StatusBarWidget::position() const
|
||||||
{
|
|
||||||
return m_viewName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IView::ViewPosition BaseView::defaultPosition() const
|
|
||||||
{
|
{
|
||||||
return m_defaultPosition;
|
return m_defaultPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseView::setUniqueViewName(const char *name)
|
QWidget *StatusBarWidget::setWidget(QWidget *widget)
|
||||||
{
|
|
||||||
m_viewName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *BaseView::setWidget(QWidget *widget)
|
|
||||||
{
|
{
|
||||||
QWidget *oldWidget = m_widget;
|
QWidget *oldWidget = m_widget;
|
||||||
m_widget = widget;
|
m_widget = widget;
|
||||||
return oldWidget;
|
return oldWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseView::setContext(const QList<int> &context)
|
void StatusBarWidget::setContext(const QList<int> &context)
|
||||||
{
|
{
|
||||||
m_context = context;
|
m_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseView::setDefaultPosition(IView::ViewPosition position)
|
void StatusBarWidget::setPosition(StatusBarWidget::StatusBarPosition position)
|
||||||
{
|
{
|
||||||
m_defaultPosition = position;
|
m_defaultPosition = position;
|
||||||
}
|
}
|
@@ -27,40 +27,39 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef BASEVIEW_H
|
#ifndef STATUSBARWIDGET_H
|
||||||
#define BASEVIEW_H
|
#define STATUSBARWIDGET_H
|
||||||
|
|
||||||
#include "core_global.h"
|
#include "core_global.h"
|
||||||
#include "iview.h"
|
#include "icontext.h"
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class CORE_EXPORT BaseView : public IView
|
class CORE_EXPORT StatusBarWidget : public IContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseView(QObject *parent = 0);
|
enum StatusBarPosition { First=0, Second=1, Third=2 };
|
||||||
~BaseView();
|
|
||||||
|
StatusBarWidget(QObject *parent = 0);
|
||||||
|
~StatusBarWidget();
|
||||||
|
|
||||||
QList<int> context() const;
|
QList<int> context() const;
|
||||||
QWidget *widget();
|
QWidget *widget();
|
||||||
const char *uniqueViewName() const;
|
StatusBarWidget::StatusBarPosition position() const;
|
||||||
IView::ViewPosition defaultPosition() const;
|
|
||||||
|
|
||||||
void setUniqueViewName(const char *name);
|
|
||||||
QWidget *setWidget(QWidget *widget);
|
QWidget *setWidget(QWidget *widget);
|
||||||
void setContext(const QList<int> &context);
|
void setContext(const QList<int> &context);
|
||||||
void setDefaultPosition(IView::ViewPosition position);
|
void setPosition(StatusBarWidget::StatusBarPosition position);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *m_viewName;
|
|
||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
QList<int> m_context;
|
QList<int> m_context;
|
||||||
IView::ViewPosition m_defaultPosition;
|
StatusBarWidget::StatusBarPosition m_defaultPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
#endif // BASEVIEW_H
|
#endif // STATUSBARWIDGET_H
|
@@ -32,7 +32,7 @@
|
|||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "uniqueidmanager.h"
|
#include "uniqueidmanager.h"
|
||||||
#include "iview.h"
|
#include "statusbarwidget.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
@@ -77,22 +77,21 @@ void ViewManager::init()
|
|||||||
|
|
||||||
void ViewManager::objectAdded(QObject *obj)
|
void ViewManager::objectAdded(QObject *obj)
|
||||||
{
|
{
|
||||||
IView *view = Aggregation::query<IView>(obj);
|
StatusBarWidget *view = Aggregation::query<StatusBarWidget>(obj);
|
||||||
if (!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QWidget *viewWidget = 0;
|
QWidget *viewWidget = 0;
|
||||||
viewWidget = view->widget();
|
viewWidget = view->widget();
|
||||||
m_statusBarWidgets.at(view->defaultPosition())->layout()->addWidget(viewWidget);
|
m_statusBarWidgets.at(view->position())->layout()->addWidget(viewWidget);
|
||||||
|
|
||||||
m_viewMap.insert(view, viewWidget);
|
m_viewMap.insert(view, viewWidget);
|
||||||
viewWidget->setObjectName(view->uniqueViewName());
|
|
||||||
m_mainWnd->addContextObject(view);
|
m_mainWnd->addContextObject(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewManager::aboutToRemoveObject(QObject *obj)
|
void ViewManager::aboutToRemoveObject(QObject *obj)
|
||||||
{
|
{
|
||||||
IView *view = Aggregation::query<IView>(obj);
|
StatusBarWidget *view = Aggregation::query<StatusBarWidget>(obj);
|
||||||
if (!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
m_mainWnd->removeContextObject(view);
|
m_mainWnd->removeContextObject(view);
|
||||||
@@ -108,14 +107,3 @@ void ViewManager::saveSettings(QSettings *settings)
|
|||||||
{
|
{
|
||||||
settings->setValue(QLatin1String("ViewGroup_Default"), m_mainWnd->saveState());
|
settings->setValue(QLatin1String("ViewGroup_Default"), m_mainWnd->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
IView *ViewManager::view(const QString &id)
|
|
||||||
{
|
|
||||||
QList<IView *> list =
|
|
||||||
ExtensionSystem::PluginManager::instance()->getObjects<IView>();
|
|
||||||
foreach (IView *view, list) {
|
|
||||||
if (view->uniqueViewName() == id)
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class IView;
|
class StatusBarWidget;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -62,13 +62,12 @@ public:
|
|||||||
void extensionsInitalized();
|
void extensionsInitalized();
|
||||||
void saveSettings(QSettings *settings);
|
void saveSettings(QSettings *settings);
|
||||||
|
|
||||||
IView * view(const QString & id);
|
|
||||||
private slots:
|
private slots:
|
||||||
void objectAdded(QObject *obj);
|
void objectAdded(QObject *obj);
|
||||||
void aboutToRemoveObject(QObject *obj);
|
void aboutToRemoveObject(QObject *obj);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<Core::IView *, QWidget *> m_viewMap;
|
QMap<Core::StatusBarWidget *, QWidget *> m_viewMap;
|
||||||
|
|
||||||
MainWindow *m_mainWnd;
|
MainWindow *m_mainWnd;
|
||||||
QList<QWidget *> m_statusBarWidgets;
|
QList<QWidget *> m_statusBarWidgets;
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include <QtCore/QFuture>
|
#include <QtCore/QFuture>
|
||||||
#include <QtCore/QFutureWatcher>
|
#include <QtCore/QFutureWatcher>
|
||||||
|
|
||||||
#include <coreplugin/baseview.h>
|
#include <coreplugin/statusbarwidget.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/settingsdatabase.h>
|
#include <coreplugin/settingsdatabase.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -95,12 +95,11 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
|
|||||||
|
|
||||||
m_locatorWidget = new LocatorWidget(this);
|
m_locatorWidget = new LocatorWidget(this);
|
||||||
m_locatorWidget->setEnabled(false);
|
m_locatorWidget->setEnabled(false);
|
||||||
Core::BaseView *view = new Core::BaseView;
|
Core::StatusBarWidget *view = new Core::StatusBarWidget;
|
||||||
view->setUniqueViewName("Locator");
|
|
||||||
view->setWidget(m_locatorWidget);
|
view->setWidget(m_locatorWidget);
|
||||||
view->setContext(QList<int>() << core->uniqueIDManager()
|
view->setContext(QList<int>() << core->uniqueIDManager()
|
||||||
->uniqueIdentifier(QLatin1String("LocatorWidget")));
|
->uniqueIdentifier(QLatin1String("LocatorWidget")));
|
||||||
view->setDefaultPosition(Core::IView::First);
|
view->setPosition(Core::StatusBarWidget::First);
|
||||||
addAutoReleasedObject(view);
|
addAutoReleasedObject(view);
|
||||||
|
|
||||||
const QString actionId = QLatin1String("QtCreator.Locate");
|
const QString actionId = QLatin1String("QtCreator.Locate");
|
||||||
|
Reference in New Issue
Block a user