summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/coreplugin')
-rw-r--r--src/plugins/coreplugin/editormanager/editorgroup.cpp285
-rw-r--r--src/plugins/coreplugin/editormanager/editorgroup.h131
-rw-r--r--src/plugins/coreplugin/editormanager/stackededitorgroup.cpp379
-rw-r--r--src/plugins/coreplugin/editormanager/stackededitorgroup.h113
4 files changed, 0 insertions, 908 deletions
diff --git a/src/plugins/coreplugin/editormanager/editorgroup.cpp b/src/plugins/coreplugin/editormanager/editorgroup.cpp
deleted file mode 100644
index 6973bf7d48..0000000000
--- a/src/plugins/coreplugin/editormanager/editorgroup.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the packaging
-** of this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#include "editorgroup.h"
-
-#include "editormanager.h"
-
-#include <coreplugin/coreconstants.h>
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include <QtGui/QPainter>
-#include <QtGui/QStyle>
-#include <QtGui/QStyleOption>
-#ifdef Q_WS_MAC
-#include <QtGui/QMacStyle>
-#endif
-
-Q_DECLARE_METATYPE(Core::IEditor*)
-
-using namespace Core;
-using namespace Core::Internal;
-
-namespace Core {
-namespace Internal {
-class EditorList;
-}
-}
-
-QDataStream &operator<<(QDataStream &out, const Core::Internal::EditorList &list);
-QDataStream &operator>>(QDataStream &in, Core::Internal::EditorList &list);
-
-namespace Core {
-namespace Internal {
-
-class EditorList
-{
-public:
- quint32 currentEditorIndex;
- void append(Core::IEditor *editor);
- QString fileNameAt(int index);
- QString editorKindAt(int index);
- int count();
-
-private:
- QList<QPair<QString,QString> > editorinfo;
-
- friend QDataStream &::operator<<(QDataStream &out, const EditorList &list);
- friend QDataStream &::operator>>(QDataStream &in, EditorList &list);
-};
-
-} // namespace Internal
-} // namespace Core
-
-
-//================EditorGroupContext===============
-
-EditorGroupContext::EditorGroupContext(EditorGroup *editorGroup)
- : IContext(editorGroup),
- m_context(QList<int>() << Constants::C_GLOBAL_ID),
- m_editorGroup(editorGroup)
-{
-}
-
-QList<int> EditorGroupContext::context() const
-{
- return m_context;
-}
-
-QWidget *EditorGroupContext::widget()
-{
- return m_editorGroup;
-}
-
-EditorGroup *EditorGroupContext::editorGroup()
-{
- return m_editorGroup;
-}
-
-//================EditorGroup=================
-
-EditorGroup::EditorGroup(QWidget *parent)
- : QFrame(parent),
- m_contextObject(new EditorGroupContext(this))
-{
- setFocusPolicy(Qt::StrongFocus);
-
- m_model = new EditorModel(this);
-}
-
-QSize EditorGroup::minimumSizeHint() const
-{
- return QSize(10, 10);
-}
-
-void EditorGroup::focusInEvent(QFocusEvent *)
-{
- update();
-}
-
-void EditorGroup::focusOutEvent(QFocusEvent *)
-{
- update();
-}
-
-void EditorGroup::paintEvent(QPaintEvent *e)
-{
- QFrame::paintEvent(e);
- if (editorCount() == 0) {
- QPainter painter(this);
-
- // Discreet indication where an editor would be
- painter.setRenderHint(QPainter::Antialiasing, true);
- painter.setPen(Qt::NoPen);
- QColor shadeBrush(Qt::black);
- shadeBrush.setAlpha(10);
- painter.setBrush(shadeBrush);
- const int r = 3;
- painter.drawRoundedRect(rect().adjusted(r, r, -r, -r), r * 2, r * 2);
-
- if (hasFocus()) {
-#ifdef Q_WS_MAC
- // With QMacStyle, we have to draw our own focus rect, since I didn't find
- // a way to draw the nice mac focus rect _inside_ this widget
- if (qobject_cast<QMacStyle *>(style())) {
- painter.setPen(Qt::DotLine);
- painter.setBrush(Qt::NoBrush);
- painter.setOpacity(0.75);
- painter.drawRect(rect());
- } else {
-#endif
- QStyleOptionFocusRect option;
- option.initFrom(this);
- option.backgroundColor = palette().color(QPalette::Background);
-
- // Some styles require a certain state flag in order to draw the focus rect
- option.state |= QStyle::State_KeyboardFocusChange;
-
- style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter);
-#ifdef Q_WS_MAC
- }
-#endif
- }
- }
-}
-
-void EditorGroup::moveEditorsFromGroup(EditorGroup *group)
-{
- foreach (IEditor *editor, group->editors()) {
- group->removeEditor(editor);
- addEditor(editor);
- }
-}
-
-void EditorGroup::moveEditorFromGroup(EditorGroup *group, IEditor *editor)
-{
- group->removeEditor(editor);
- addEditor(editor);
-}
-
-QByteArray EditorGroup::saveState() const
-{
- QByteArray bytes;
- QDataStream stream(&bytes, QIODevice::WriteOnly);
- EditorList editorinfo;
- IEditor *curr = currentEditor();
- QList<IEditor *> editors = editorsInNaturalOrder();
- for (int j = 0; j < editors.count(); ++j) {
- IEditor *editor = editors.at(j);
- if (editor == curr)
- editorinfo.currentEditorIndex = j;
- editorinfo.append(editor);
- }
- stream << editorinfo;
- return bytes;
-}
-
-bool EditorGroup::restoreState(const QByteArray &state)
-{
- QDataStream in(state);
- EditorManager *em = EditorManager::instance();
- EditorList editors;
- in >> editors;
- int savedIndex = editors.currentEditorIndex;
- if (savedIndex >= 0 && savedIndex < editors.count())
- em->restoreEditor(editors.fileNameAt(savedIndex), editors.editorKindAt(savedIndex), this);
- for (int j = 0; j < editors.count(); ++j) {
- if (j == savedIndex)
- continue;
- em->restoreEditor(editors.fileNameAt(j), editors.editorKindAt(j), this);
- }
- return true;
-}
-
-void EditorGroup::addEditor(IEditor *editor)
-{
- m_model->addEditor(editor);
-}
-
-void EditorGroup::insertEditor(int i, IEditor *editor)
-{
- m_model->insertEditor(i, editor);
-}
-
-void EditorGroup::removeEditor(IEditor *editor)
-{
- m_model->removeEditor(editor);
-}
-
-void EditorGroup::showEditorInfoBar(const QString &, const QString &, const QString &, QObject *, const char *)
-{
-}
-
-void EditorGroup::hideEditorInfoBar(const QString &)
-{
-}
-
-void EditorList::append(IEditor *editor)
-{
- if (editor->file()->fileName().isEmpty())
- return;
- editorinfo << qMakePair(editor->file()->fileName(), QString(editor->kind()));
-}
-
-QDataStream &operator<<(QDataStream &out, const EditorList &list)
-{
- //todo: versioning
- out << list.currentEditorIndex << list.editorinfo;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, EditorList &list)
-{
- //todo: versioning
- in >> list.currentEditorIndex;
- in >> list.editorinfo;
- return in;
-}
-
-QString EditorList::fileNameAt(int index)
-{
- return editorinfo.at(index).first;
-}
-
-QString EditorList::editorKindAt(int index)
-{
- return editorinfo.at(index).second;
-}
-
-int EditorList::count()
-{
- return editorinfo.count();
-}
diff --git a/src/plugins/coreplugin/editormanager/editorgroup.h b/src/plugins/coreplugin/editormanager/editorgroup.h
deleted file mode 100644
index 9a40baaeb8..0000000000
--- a/src/plugins/coreplugin/editormanager/editorgroup.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the packaging
-** of this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#ifndef EDITORGROUP_H
-#define EDITORGROUP_H
-
-#include <coreplugin/icontext.h>
-
-#include <QtCore/QEvent>
-#include <QtCore/QAbstractListModel>
-
-#include <QtGui/QFrame>
-#include <QtGui/QAbstractButton>
-#include <QtGui/QPen>
-
-namespace Core {
-
-class IEditor;
-class EditorGroup;
-
-namespace Internal {
-
-class EditorModel;
-
-// Also used by the EditorManager
-class EditorGroupContext : public IContext
-{
- Q_OBJECT
-
-public:
- EditorGroupContext(EditorGroup *editorGroup);
- EditorGroup *editorGroup();
- // IContext
- QList<int> context() const;
- QWidget *widget();
-private:
- QList<int> m_context;
- EditorGroup *m_editorGroup;
-};
-
-} // namespace Internal
-
-class CORE_EXPORT EditorGroup : public QFrame
-{
- Q_OBJECT
-
-public:
- EditorGroup(QWidget *parent);
- virtual ~EditorGroup() {};
-
- virtual IContext *contextObject() { return m_contextObject; }
- virtual QWidget *widget() { return this; }
-
- virtual int editorCount() const = 0;
- virtual void addEditor(IEditor *editor);
- virtual void insertEditor(int i, IEditor *editor);
- virtual void removeEditor(IEditor *editor);
- virtual QList<IEditor*> editors() const = 0;
-
- virtual IEditor *currentEditor() const = 0;
- virtual void setCurrentEditor(IEditor *editor) = 0;
-
- virtual void moveEditorsFromGroup(EditorGroup *group);
- virtual void moveEditorFromGroup(EditorGroup *group, IEditor *editor);
-
- virtual QByteArray saveState() const;
- virtual bool restoreState(const QByteArray &state);
-
- virtual void showEditorInfoBar(const QString &kind,
- const QString &infoText,
- const QString &buttonText,
- QObject *object, const char *member);
-
- virtual void hideEditorInfoBar(const QString &kind);
-
- QSize minimumSizeHint() const;
- void focusInEvent(QFocusEvent *e);
- void focusOutEvent(QFocusEvent *e);
- void paintEvent(QPaintEvent *e);
-
-signals:
- void closeRequested(Core::IEditor *editor);
- void editorRemoved(Core::IEditor *editor);
- void editorAdded(Core::IEditor *editor);
-
-protected:
- virtual QList<IEditor *> editorsInNaturalOrder() const { return editors(); }
- Internal::EditorModel *model() const { return m_model; }
-
-private:
- Internal::EditorGroupContext *m_contextObject;
- Internal::EditorModel *m_model;
-};
-
-namespace Internal {
-
-
-} // namespace Internal
-} // namespace Core
-
-#endif // EDITORGROUP_H
diff --git a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp b/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp
deleted file mode 100644
index 82ab917bc4..0000000000
--- a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the packaging
-** of this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#include "stackededitorgroup.h"
-#include "editormanager.h"
-#include "editorview.h"
-
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-#include <QtCore/QFileInfo>
-#include <QtCore/QMimeData>
-
-#include <QtGui/QApplication>
-#include <QtGui/QComboBox>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QPainter>
-#include <QtGui/QStackedWidget>
-#include <QtGui/QStyle>
-#include <QtGui/QStyleOption>
-#include <QtGui/QToolBar>
-#include <QtGui/QToolButton>
-#ifdef Q_WS_MAC
-#include <qmacstyle_mac.h>
-#endif
-
-Q_DECLARE_METATYPE(Core::IEditor *)
-
-using namespace Core;
-using namespace Core::Internal;
-
-StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
- EditorGroup(parent),
- m_toplevel(new QWidget),
- m_toolBar(new QWidget),
- m_container(new QStackedWidget(this)),
- m_editorList(new QComboBox),
- m_closeButton(new QToolButton),
- m_lockButton(new QToolButton),
- m_defaultToolBar(new QToolBar(this)),
- m_infoWidget(new QFrame(this)),
- m_editorForInfoWidget(0)
-{
- QVBoxLayout *tl = new QVBoxLayout(m_toplevel);
- tl->setSpacing(0);
- tl->setMargin(0);
- {
- m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_editorList->setSizeAdjustPolicy(QComboBox::AdjustToContents);
- m_editorList->setMinimumContentsLength(20);
- m_proxyModel.setSourceModel(model());
- m_proxyModel.sort(0);
- m_editorList->setModel(&m_proxyModel);
- m_editorList->setMaxVisibleItems(40);
-
- QToolBar *editorListToolBar = new QToolBar;
-
- editorListToolBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
- editorListToolBar->addWidget(m_editorList);
-
- m_defaultToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
- m_activeToolBar = m_defaultToolBar;
-
- QHBoxLayout *toolBarLayout = new QHBoxLayout;
- toolBarLayout->setMargin(0);
- toolBarLayout->setSpacing(0);
- toolBarLayout->addWidget(m_defaultToolBar);
- m_toolBar->setLayout(toolBarLayout);
-
- m_lockButton->setAutoRaise(true);
- m_lockButton->setProperty("type", QLatin1String("dockbutton"));
-
- m_closeButton->setAutoRaise(true);
- m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
- m_closeButton->setProperty("type", QLatin1String("dockbutton"));
-
- QToolBar *rightToolBar = new QToolBar;
- rightToolBar->setLayoutDirection(Qt::RightToLeft);
- rightToolBar->addWidget(m_closeButton);
- rightToolBar->addWidget(m_lockButton);
-
- QHBoxLayout *toplayout = new QHBoxLayout;
- toplayout->setSpacing(0);
- toplayout->setMargin(0);
- toplayout->addWidget(editorListToolBar);
- toplayout->addWidget(m_toolBar, 1); // Custom toolbar stretches
- toplayout->addWidget(rightToolBar);
-
- QWidget *top = new QWidget;
- QVBoxLayout *vlayout = new QVBoxLayout(top);
- vlayout->setSpacing(0);
- vlayout->setMargin(0);
- vlayout->addLayout(toplayout);
- tl->addWidget(top);
-
- connect(m_editorList, SIGNAL(currentIndexChanged(int)), this, SLOT(listSelectionChanged(int)));
- connect(m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable()));
- connect(m_closeButton, SIGNAL(clicked()), this, SLOT(sendCloseRequest()));
- }
- {
- m_infoWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
- m_infoWidget->setLineWidth(1);
- m_infoWidget->setForegroundRole(QPalette::ToolTipText);
- m_infoWidget->setBackgroundRole(QPalette::ToolTipBase);
- m_infoWidget->setAutoFillBackground(true);
-
-
- QHBoxLayout *hbox = new QHBoxLayout(m_infoWidget);
- hbox->setMargin(2);
- m_infoWidgetLabel = new QLabel("Placeholder");
- m_infoWidgetLabel->setForegroundRole(QPalette::ToolTipText);
- hbox->addWidget(m_infoWidgetLabel);
- hbox->addStretch(1);
-
- m_infoWidgetButton = new QToolButton;
- m_infoWidgetButton->setText(tr("Placeholder"));
- hbox->addWidget(m_infoWidgetButton);
-
- QToolButton *closeButton = new QToolButton;
- closeButton->setAutoRaise(true);
- closeButton->setIcon(QIcon(":/core/images/clear.png"));
- closeButton->setToolTip(tr("Close"));
- connect(closeButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide()));
-
- hbox->addWidget(closeButton);
-
-
- m_infoWidget->setVisible(false);
- tl->addWidget(m_infoWidget);
- }
- tl->addWidget(m_container);
-
- QHBoxLayout *l = new QHBoxLayout;
- l->setSpacing(0);
- l->setMargin(0);
- l->addWidget(m_toplevel);
- setLayout(l);
-}
-
-void StackedEditorGroup::showEditorInfoBar(const QString &kind,
- const QString &infoText,
- const QString &buttonText,
- QObject *object, const char *member)
-{
- m_infoWidgetKind = kind;
- m_infoWidgetLabel->setText(infoText);
- m_infoWidgetButton->setText(buttonText);
- m_infoWidgetButton->disconnect();
- if (object && member)
- connect(m_infoWidgetButton, SIGNAL(clicked()), object, member);
- m_infoWidget->setVisible(true);
- m_editorForInfoWidget = currentEditor();
-}
-
-void StackedEditorGroup::hideEditorInfoBar(const QString &kind)
-{
- if (kind == m_infoWidgetKind)
- m_infoWidget->setVisible(false);
-}
-
-
-StackedEditorGroup::~StackedEditorGroup()
-{
-}
-
-void StackedEditorGroup::focusInEvent(QFocusEvent *e)
-{
- if (m_container->count() > 0) {
- setEditorFocus(m_container->currentIndex());
- } else {
- EditorGroup::focusInEvent(e);
- }
-}
-
-void StackedEditorGroup::setEditorFocus(int index)
-{
- QWidget *w = m_container->widget(index);
- w->setFocus();
-}
-
-void StackedEditorGroup::addEditor(IEditor *editor)
-{
- insertEditor(editorCount(), editor);
-}
-
-void StackedEditorGroup::insertEditor(int index, IEditor *editor)
-{
- if (m_container->indexOf(editor->widget()) != -1)
- return;
-
- m_container->insertWidget(index, editor->widget());
- m_widgetEditorMap.insert(editor->widget(), editor);
-
- QToolBar *toolBar = editor->toolBar();
- if (toolBar) {
- toolBar->setVisible(false); // will be made visible in setCurrentEditor
- m_toolBar->layout()->addWidget(toolBar);
- }
- connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
-
- bool block = m_editorList->blockSignals(true);
- EditorGroup::insertEditor(index, editor);
- m_editorList->blockSignals(block);
- emit editorAdded(editor);
-}
-
-void StackedEditorGroup::sendCloseRequest()
-{
- emit closeRequested(currentEditor());
-}
-
-void StackedEditorGroup::removeEditor(IEditor *editor)
-{
- QTC_ASSERT(editor, return);
- EditorGroup::removeEditor(editor);
- const int index = m_container->indexOf(editor->widget());
- if (index != -1) {
- m_container->removeWidget(editor->widget());
- m_widgetEditorMap.remove(editor->widget());
- editor->widget()->setParent(0);
- disconnect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
- QToolBar *toolBar = editor->toolBar();
- if (toolBar != 0) {
- if (m_activeToolBar == toolBar) {
- m_activeToolBar = m_defaultToolBar;
- m_activeToolBar->setVisible(true);
- }
- m_toolBar->layout()->removeWidget(toolBar);
- toolBar->setVisible(false);
- toolBar->setParent(0);
- }
- emit editorRemoved(editor);
- }
-}
-
-IEditor *StackedEditorGroup::currentEditor() const
-{
- if (m_container->count() > 0)
- return m_widgetEditorMap.value(m_container->currentWidget());
- return 0;
-}
-
-void StackedEditorGroup::setCurrentEditor(IEditor *editor)
-{
- if (!editor || m_container->count() <= 0
- || m_container->indexOf(editor->widget()) == -1)
- return;
- const int idx = m_container->indexOf(editor->widget());
- QTC_ASSERT(idx >= 0, return);
- if (m_container->currentIndex() != idx) {
- m_container->setCurrentIndex(idx);
-
- const bool block = m_editorList->blockSignals(true);
- m_editorList->setCurrentIndex(indexOf(editor));
- m_editorList->blockSignals(block);
- }
- setEditorFocus(idx);
-
- updateEditorStatus(editor);
- updateToolBar(editor);
- if (editor != m_editorForInfoWidget) {
- m_infoWidget->hide();
- m_editorForInfoWidget = 0;
- }
-}
-
-void StackedEditorGroup::checkEditorStatus()
-{
- IEditor *editor = qobject_cast<IEditor *>(sender());
- if (editor == currentEditor())
- updateEditorStatus(editor);
-}
-
-void StackedEditorGroup::updateEditorStatus(IEditor *editor)
-{
- static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png"));
- static const QIcon unlockedIcon(QLatin1String(":/core/images/unlocked.png"));
-
- if (editor->file()->isReadOnly()) {
- m_lockButton->setIcon(lockedIcon);
- m_lockButton->setEnabled(!editor->file()->fileName().isEmpty());
- m_lockButton->setToolTip(tr("Make writable"));
- } else {
- m_lockButton->setIcon(unlockedIcon);
- m_lockButton->setEnabled(false);
- m_lockButton->setToolTip(tr("File is writable"));
- }
- if (currentEditor() == editor)
- m_editorList->setToolTip(model()->data(model()->indexOf(editor), Qt::ToolTipRole).toString());
- model()->emitDataChanged(editor);
-}
-
-void StackedEditorGroup::updateToolBar(IEditor *editor)
-{
- QToolBar *toolBar = editor->toolBar();
- if (!toolBar)
- toolBar = m_defaultToolBar;
- if (m_activeToolBar == toolBar)
- return;
- toolBar->setVisible(true);
- m_activeToolBar->setVisible(false);
- m_activeToolBar = toolBar;
-}
-
-int StackedEditorGroup::editorCount() const
-{
- return model()->editors().count();
-}
-
-QList<IEditor *> StackedEditorGroup::editors() const
-{
- QAbstractItemModel *model = m_editorList->model();
- QList<IEditor*> output;
- int rows = model->rowCount();
- for (int i = 0; i < rows; ++i)
- output.append(model->data(model->index(i, 0), Qt::UserRole).value<IEditor*>());
- return output;
-}
-
-QList<IEditor *> StackedEditorGroup::editorsInNaturalOrder() const
-{
- return model()->editors();
-}
-
-void StackedEditorGroup::makeEditorWritable()
-{
- EditorManager::instance()->makeEditorWritable(currentEditor());
-}
-
-void StackedEditorGroup::listSelectionChanged(int index)
-{
- QAbstractItemModel *model = m_editorList->model();
- setCurrentEditor(model->data(model->index(index, 0), Qt::UserRole).value<IEditor*>());
-}
-
-int StackedEditorGroup::indexOf(IEditor *editor)
-{
- QAbstractItemModel *model = m_editorList->model();
- int rows = model->rowCount();
- for (int i = 0; i < rows; ++i) {
- if (editor == model->data(model->index(i, 0), Qt::UserRole).value<IEditor*>())
- return i;
- }
- QTC_ASSERT(false, /**/);
- return 0;
-}
diff --git a/src/plugins/coreplugin/editormanager/stackededitorgroup.h b/src/plugins/coreplugin/editormanager/stackededitorgroup.h
deleted file mode 100644
index 7557830239..0000000000
--- a/src/plugins/coreplugin/editormanager/stackededitorgroup.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the packaging
-** of this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#ifndef STACKEDEDITORGROUP_H
-#define STACKEDEDITORGROUP_H
-
-#include "editorgroup.h"
-
-#include <QtCore/QMap>
-#include <QtGui/QSortFilterProxyModel>
-
-QT_BEGIN_NAMESPACE
-class QComboBox;
-class QToolBar;
-class QToolButton;
-class QLabel;
-class QStackedWidget;
-QT_END_NAMESPACE
-
-namespace Core {
-namespace Internal {
-
-class StackedEditorGroup : public EditorGroup
-{
- Q_OBJECT
-
-public:
- StackedEditorGroup(QWidget *parent = 0);
- virtual ~StackedEditorGroup();
-
- //EditorGroup
- int editorCount() const;
- void addEditor(IEditor *editor);
- void insertEditor(int i, IEditor *editor);
- void removeEditor(IEditor *editor);
- IEditor *currentEditor() const;
- void setCurrentEditor(IEditor *editor);
- QList<IEditor *> editors() const;
- void showEditorInfoBar(const QString &kind,
- const QString &infoText,
- const QString &buttonText,
- QObject *object, const char *member);
- void hideEditorInfoBar(const QString &kind);
-
- void focusInEvent(QFocusEvent *e);
-
-protected:
- QList<IEditor *> editorsInNaturalOrder() const;
-
-private slots:
- void sendCloseRequest();
- void updateEditorStatus(Core::IEditor *editor = 0);
- void checkEditorStatus();
- void setEditorFocus(int index);
- void makeEditorWritable();
- void listSelectionChanged(int index);
-
-private:
- void updateToolBar(IEditor *editor);
- int indexOf(IEditor *editor);
- void checkProjectLoaded(IEditor *editor);
-
- QWidget *m_toplevel;
- QWidget *m_toolBar;
- QToolBar *m_activeToolBar;
- QStackedWidget *m_container;
- QComboBox *m_editorList;
- QToolButton *m_closeButton;
- QToolButton *m_lockButton;
- QToolBar *m_defaultToolBar;
- QString m_infoWidgetKind;
- QFrame *m_infoWidget;
- QLabel *m_infoWidgetLabel;
- QToolButton *m_infoWidgetButton;
- IEditor *m_editorForInfoWidget;
- QSortFilterProxyModel m_proxyModel;
- QMap<QWidget *, IEditor *> m_widgetEditorMap;
-};
-
-} // namespace Internal
-} // namespace Core
-
-#endif // STACKEDEDITORGROUP_H