Commit d6057ae6 authored by Friedemann Kleint's avatar Friedemann Kleint

Header cleanup in coreplugin, part 1

parent b8cc8e21
......@@ -104,7 +104,10 @@ SOURCES += mainwindow.cpp \
ssh/sftpoperation.cpp \
ssh/sftpincomingpacket.cpp \
ssh/sftpdefs.cpp \
ssh/sftpchannel.cpp
ssh/sftpchannel.cpp \
outputpanemanager.cpp \
navigationsubwidget.cpp \
sidebarwidget.cpp
HEADERS += mainwindow.h \
editmode.h \
......@@ -212,7 +215,10 @@ HEADERS += mainwindow.h \
ssh/sftpincomingpacket_p.h \
ssh/sftpdefs.h \
ssh/sftpchannel.h \
ssh/sftpchannel_p.h
ssh/sftpchannel_p.h \
outputpanemanager.h \
navigationsubwidget.h \
sidebarwidget.h
FORMS += dialogs/newdialog.ui \
actionmanager/commandmappings.ui \
......
......@@ -43,6 +43,7 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QWidget>
#include <QtGui/QSplitter>
#include <QtGui/QIcon>
using namespace Core;
using namespace Core::Internal;
......
This diff is collapsed.
......@@ -31,25 +31,15 @@
#define FAKETOOLBAR_H
#include "core_global.h"
#include <QWidget>
#include <QtCore/QPointer>
#include <utils/styledbar.h>
#include <QtCore/QScopedPointer>
QT_BEGIN_NAMESPACE
class QComboBox;
class QToolButton;
class QToolBar;
QT_END_NAMESPACE
#include <utils/styledbar.h>
namespace Core {
class IEditor;
class OpenEditorsModel;
namespace Internal {
class EditorView;
}
struct EditorToolBarPrivate;
/**
* Fakes an IEditor-like toolbar for design mode widgets such as Qt Designer and Bauhaus.
......@@ -61,6 +51,7 @@ class CORE_EXPORT EditorToolBar : public Utils::StyledBar
Q_DISABLE_COPY(EditorToolBar)
public:
explicit EditorToolBar(QWidget *parent = 0);
virtual ~EditorToolBar();
enum ToolbarCreationFlags { FlagsNone = 0, FlagsStandalone = 1 };
......@@ -109,23 +100,10 @@ private slots:
private:
void updateToolBar(QWidget *toolBar);
IEditor *currentEditor() const;
Core::OpenEditorsModel *m_editorsListModel;
QComboBox *m_editorList;
QToolButton *m_closeButton;
QToolButton *m_lockButton;
QAction *m_goBackAction;
QAction *m_goForwardAction;
QToolButton *m_backButton;
QToolButton *m_forwardButton;
QWidget *m_activeToolBar;
QWidget *m_toolBarPlaceholder;
QWidget *m_defaultToolBar;
bool m_isStandalone;
};
}
QScopedPointer<EditorToolBarPrivate> d;
};
} // namespace Core
#endif // FAKETOOLBAR_H
This diff is collapsed.
......@@ -32,20 +32,18 @@
#include "core_global.h"
#include <QtCore/QHash>
#include <QtCore/QMap>
#include <QtCore/QScopedPointer>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QUrl>
#include <QtCore/QVariant>
#include <QtCore/QByteArray>
#include <QtCore/QMap>
#include <QtCore/QHash>
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
QT_FORWARD_DECLARE_CLASS(QSqlQuery)
QT_FORWARD_DECLARE_CLASS(QUrl)
namespace Core {
struct HelpManagerPrivate;
class CORE_EXPORT HelpManager : public QObject
{
......@@ -54,7 +52,6 @@ class CORE_EXPORT HelpManager : public QObject
public:
typedef QHash<QString, QStringList> Filters;
explicit HelpManager(QObject *parent = 0);
virtual ~HelpManager();
......@@ -99,16 +96,7 @@ private slots:
private:
void verifyDocumenation();
private:
bool m_needsSetup;
QHelpEngineCore *m_helpEngine;
QFileSystemWatcher *m_collectionWatcher;
QStringList m_filesToRegister;
QStringList m_nameSpacesToUnregister;
QHash<QString, QVariant> m_customValues;
static HelpManager *m_instance;
QScopedPointer<HelpManagerPrivate> d;
};
} // Core
......
......@@ -43,6 +43,7 @@
#include "modemanager.h"
#include "mimedatabase.h"
#include "newdialog.h"
#include "outputpanemanager.h"
#include "outputpane.h"
#include "plugindialog.h"
#include "progressmanager_p.h"
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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.
**
**************************************************************************/
#include "navigationsubwidget.h"
#include "navigationwidget.h"
#include "icore.h"
#include "icontext.h"
#include "coreconstants.h"
#include "inavigationwidgetfactory.h"
#include "modemanager.h"
#include "actionmanager/actionmanager.h"
#include "actionmanager/command.h"
#include "uniqueidmanager.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/styledbar.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QAction>
#include <QtGui/QHBoxLayout>
#include <QtGui/QResizeEvent>
#include <QtGui/QToolButton>
#include <QtGui/QShortcut>
#include <QtGui/QStandardItemModel>
Q_DECLARE_METATYPE(Core::INavigationWidgetFactory *)
namespace Core {
namespace Internal {
////
// NavigationSubWidget
////
NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget, int position, int factoryIndex)
: m_parentWidget(parentWidget),
m_position(position)
{
m_navigationComboBox = new NavComboBox(this);
m_navigationComboBox->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
m_navigationComboBox->setFocusPolicy(Qt::TabFocus);
m_navigationComboBox->setMinimumContentsLength(0);
m_navigationComboBox->setModel(parentWidget->factoryModel());
m_navigationWidget = 0;
m_navigationWidgetFactory = 0;
m_toolBar = new Utils::StyledBar(this);
QHBoxLayout *toolBarLayout = new QHBoxLayout;
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);
m_toolBar->setLayout(toolBarLayout);
toolBarLayout->addWidget(m_navigationComboBox);
QToolButton *splitAction = new QToolButton();
splitAction->setIcon(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL)));
splitAction->setToolTip(tr("Split"));
QToolButton *close = new QToolButton();
close->setIcon(QIcon(QLatin1String(Constants::ICON_CLOSE)));
close->setToolTip(tr("Close"));
toolBarLayout->addWidget(splitAction);
toolBarLayout->addWidget(close);
QVBoxLayout *lay = new QVBoxLayout();
lay->setMargin(0);
lay->setSpacing(0);
setLayout(lay);
lay->addWidget(m_toolBar);
connect(splitAction, SIGNAL(clicked()), this, SIGNAL(splitMe()));
connect(close, SIGNAL(clicked()), this, SIGNAL(closeMe()));
setFactoryIndex(factoryIndex);
connect(m_navigationComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(comboBoxIndexChanged(int)));
comboBoxIndexChanged(factoryIndex);
}
NavigationSubWidget::~NavigationSubWidget()
{
}
void NavigationSubWidget::comboBoxIndexChanged(int factoryIndex)
{
saveSettings();
// Remove toolbutton
foreach (QWidget *w, m_additionalToolBarWidgets)
delete w;
m_additionalToolBarWidgets.clear();
// Remove old Widget
delete m_navigationWidget;
m_navigationWidget = 0;
m_navigationWidgetFactory = 0;
if (factoryIndex == -1)
return;
// Get new stuff
m_navigationWidgetFactory = m_navigationComboBox->itemData(factoryIndex,
NavigationWidget::FactoryObjectRole).value<INavigationWidgetFactory *>();
NavigationView n = m_navigationWidgetFactory->createWidget();
m_navigationWidget = n.widget;
layout()->addWidget(m_navigationWidget);
// Add Toolbutton
m_additionalToolBarWidgets = n.dockToolBarWidgets;
QHBoxLayout *layout = qobject_cast<QHBoxLayout *>(m_toolBar->layout());
foreach (QToolButton *w, m_additionalToolBarWidgets) {
layout->insertWidget(layout->count()-2, w);
}
restoreSettings();
}
void NavigationSubWidget::setFocusWidget()
{
if (m_navigationWidget)
m_navigationWidget->setFocus();
}
INavigationWidgetFactory *NavigationSubWidget::factory()
{
return m_navigationWidgetFactory;
}
void NavigationSubWidget::saveSettings()
{
if (!m_navigationWidget || !factory())
return;
factory()->saveSettings(position(), m_navigationWidget);
}
void NavigationSubWidget::restoreSettings()
{
if (!m_navigationWidget || !factory())
return;
factory()->restoreSettings(position(), m_navigationWidget);
}
Core::Command *NavigationSubWidget::command(const QString &title) const
{
const QHash<QString, Core::Command*> commandMap = m_parentWidget->commandMap();
QHash<QString, Core::Command*>::const_iterator r = commandMap.find(title);
if (r != commandMap.end())
return r.value();
return 0;
}
int NavigationSubWidget::factoryIndex() const
{
return m_navigationComboBox->currentIndex();
}
void NavigationSubWidget::setFactoryIndex(int i)
{
m_navigationComboBox->setCurrentIndex(i);
}
int NavigationSubWidget::position() const
{
return m_position;
}
void NavigationSubWidget::setPosition(int position)
{
m_position = position;
}
CommandComboBox::CommandComboBox(QWidget *parent) : QComboBox(parent)
{
}
bool CommandComboBox::event(QEvent *e)
{
if (e->type() == QEvent::ToolTip) {
const QString text = currentText();
if (const Core::Command *cmd = command(text)) {
const QString tooltip = tr("Activate %1").arg(text);
setToolTip(cmd->stringWithAppendedShortcut(tooltip));
} else {
setToolTip(text);
}
}
return QComboBox::event(e);
}
} // namespace Internal
} // namespace Core
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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 NAVIGATIONSSUBWIDGET_H
#define NAVIGATIONSSUBWIDGET_H
#include <QtGui/QComboBox>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QToolButton;
QT_END_NAMESPACE
namespace Utils {
class StyledBar;
}
namespace Core {
class INavigationWidgetFactory;
class IMode;
class Command;
class NavigationWidget;
namespace Internal {
class NavigationSubWidget : public QWidget
{
Q_OBJECT
public:
NavigationSubWidget(NavigationWidget *parentWidget, int position, int index);
virtual ~NavigationSubWidget();
INavigationWidgetFactory *factory();
int factoryIndex() const;
void setFactoryIndex(int i);
void setFocusWidget();
int position() const;
void setPosition(int i);
void saveSettings();
void restoreSettings();
Core::Command *command(const QString &title) const;
signals:
void splitMe();
void closeMe();
private slots:
void comboBoxIndexChanged(int);
private:
NavigationWidget *m_parentWidget;
QComboBox *m_navigationComboBox;
QWidget *m_navigationWidget;
INavigationWidgetFactory *m_navigationWidgetFactory;
Utils::StyledBar *m_toolBar;
QList<QToolButton *> m_additionalToolBarWidgets;
int m_position;
};
// A combo associated with a command. Shows the command text
// and shortcut in the tooltip.
class CommandComboBox : public QComboBox
{
Q_OBJECT
public:
explicit CommandComboBox(QWidget *parent = 0);
protected:
bool event(QEvent *event);
private:
virtual const Core::Command *command(const QString &text) const = 0;
};
class NavComboBox : public CommandComboBox
{
Q_OBJECT
public:
explicit NavComboBox(NavigationSubWidget *navSubWidget) :
m_navSubWidget(navSubWidget) {}
private:
virtual const Core::Command *command(const QString &text) const
{ return m_navSubWidget->command(text); }
NavigationSubWidget *m_navSubWidget;
};
} // namespace Internal
} // namespace Core
#endif // NAVIGATIONSSUBWIDGET_H
This diff is collapsed.
......@@ -32,24 +32,25 @@
#include <coreplugin/minisplitter.h>
#include <QtGui/QComboBox>
#include <QtCore/QHash>
#include <QtCore/QScopedPointer>
QT_BEGIN_NAMESPACE
class QSettings;
class QShortcut;
class QToolButton;
class QAbstractItemModel;
class QStandardItemModel;
QT_END_NAMESPACE
namespace Utils {
class StyledBar;
}
namespace Core {
class INavigationWidgetFactory;
class IMode;
class Command;
class NavigationWidget;
struct NavigationWidgetPrivate;
namespace Internal {
class NavigationSubWidget;
}
class CORE_EXPORT NavigationWidgetPlaceHolder : public QWidget
{
......@@ -57,20 +58,18 @@ class CORE_EXPORT NavigationWidgetPlaceHolder : public QWidget
Q_OBJECT
public:
explicit NavigationWidgetPlaceHolder(Core::IMode *mode, QWidget *parent = 0);
~NavigationWidgetPlaceHolder();
virtual ~NavigationWidgetPlaceHolder();
static NavigationWidgetPlaceHolder* current();
void applyStoredSize(int width);
private slots:
void currentModeAboutToChange(Core::IMode *);
private:
Core::IMode *m_mode;
static NavigationWidgetPlaceHolder* m_current;
};
namespace Internal {
class NavigationSubWidget;
}
class CORE_EXPORT NavigationWidget : public MiniSplitter
{
Q_OBJECT
......@@ -81,9 +80,8 @@ public:
FactoryPriorityRole
};
NavigationWidget(QAction *toggleSideBarAction);
~NavigationWidget();
explicit NavigationWidget(QAction *toggleSideBarAction);
virtual ~NavigationWidget();
void setFactories(const QList<INavigationWidgetFactory*> factories);
......@@ -106,7 +104,7 @@ public:
// Called from the place holders
void placeHolderChanged(NavigationWidgetPlaceHolder *holder);
QHash<QString, Core::Command*> commandMap() const { return m_commandMap; }
QHash<QString, Core::Command*> commandMap() const;
QAbstractItemModel *factoryModel() const;
protected:
......@@ -122,74 +120,9 @@ private:
Internal::NavigationSubWidget *insertSubItem(int position, int index);
int factoryIndex(const QString &id);
QList<Internal::NavigationSubWidget *> m_subWidgets;
QHash<QShortcut *, QString> m_shortcutMap;
QHash<QString, Core::Command*> m_commandMap;
QStandardItemModel *m_factoryModel;
bool m_shown;
bool m_suppressed;
int m_width;
static NavigationWidget* m_instance;
QAction *m_toggleSideBarAction;
};
namespace Internal {
class NavigationSubWidget : public QWidget
{
Q_OBJECT
public:
NavigationSubWidget(NavigationWidget *parentWidget, int position, int index);
virtual ~NavigationSubWidget();
INavigationWidgetFactory *factory();
int factoryIndex() const;
void setFactoryIndex(int i);
void setFocusWidget();
int position() const;
void setPosition(int i);
void saveSettings();
void restoreSettings();
Core::Command *command(const QString &title) const;
signals:
void splitMe();
void closeMe();
private slots:
void comboBoxIndexChanged(int);
private:
NavigationWidget *m_parentWidget;
QComboBox *m_navigationComboBox;
QWidget *m_navigationWidget;