Commit 713105ad authored by con's avatar con

Some documentation.

parent 78e5293f
......@@ -9,6 +9,8 @@
simple means for plugin cooperation that allow plugins to provide
hooks for other plugin's extensions.
To get an overview of what parts of QtCreator are extensible, have a look at the \l{Common Extension Tasks} page.
\section1 Core Libraries
There are a few core libraries used by many parts of Qt Creator.
......@@ -19,12 +21,12 @@
\o Description
\row
\o \l{Aggregation}{Aggregation}
\o \l{Aggregation}
\o Adds functionality for "glueing" QObjects of different
types together, so you can "cast" between them.
\row
\o \l{ExtensionSystem}{ExtensionSystem}
\o \l{ExtensionSystem}
\o Implements the plugin loader framework. Provides a base class for plugins and
basic mechanisms for plugin interaction like an object pool.
......@@ -43,10 +45,18 @@
\o Description
\row
\o \l{Core} {Core}
\o \l{Core}
\o The core plugin. Provides the main window and managers for editors,
actions, mode windows and files, just to mention the most important ones.
\row
\o \l{Find}
\o Support for searching text in arbitrary widgets, and arbitrary other things.
\row
\o \l{QuickOpen}
\o Hooks for providing content for Locator.
\endtable
*/
......@@ -79,3 +89,85 @@
\generatelist functionindex
*/
/*!
\page common_extension_tasks.html
\title Common Extension Tasks
\table
\header
\o Task
\o Details
\o API
\row
\o Add a menu / menu entry.
\o You can extend existing menus or create new ones.
\o \l{Core::ActionManager}, \l{Core::Command}, \l{Core::ICore::actionManager()}
\row
\o Add a configurable keyboard shortcut.
\o Registerng shortcuts makes it possible for users to configure them in the common shortcut settings dialog.
\o \l{Core::ActionManager}, \l{Core::Command}, \l{Core::ICore::actionManager()}
\row
\o Add a mode.
\o Modes correspond to complete screens of controls, specialized for a task.
\o \l{Core::IMode}, \l{Core::BaseMode}
\row
\o Add a new editor type.
\o Like an editor for xml files.
\o \l{Core::IEditorFactory}, \l{Core::IEditor}, \l{Core::IFile}
\row
\o Add a "New" wizard.
\o That is added to the list when users do File->New..., allows you to basically do whatever you want.
\o \l{Core::IWizard}, \l{Core::StandardFileWizard}, \l{Core::BaseFileWizard}, \l{Core::BaseFileWizardParameters}
\row
\o Add support for a new version control system.
\o Version control systems provided by QtCreator itself are Perforce, Git and Subversion.
\o \l{Core::IVersionControl}
\row
\o Add a view to the navigation sidebar.
\o The one which shows the project tree, filesystem, open documents or bookmarks.
\o \l{Core::INavigationWidgetFactory}
\row
\o Add a preferences page to the preferences dialog.
\o Add a new page to existing or new category in Tools->Options.
\o \l{Core::IOptionsPage}
\row
\o Add a find filter for the find dialog.
\o Implement any kind of search term based search.
\o \l{Find::IFindFilter}, \l{Find::SearchResultWindow}, \l{Find::ResultWindowItem}
\row
\o Add support for the find tool bar to a widget.
\o The widget that has focus is asked if it supports text search, you can provide that for widgets under your control.
\o \l{Find::IFindSupport}, \l{Find::BaseTextFind}
\row
\o Add a completely new project type.
\o
\o
\row
\o Add a new type of build step.
\o
\o
\row
\o Add a new filter to Locator.
\o For a text typed in by the user you provide a list of things to show in the popup. When the user selects an entry you are requested to do whatever you want.
\o \l{QuickOpen::IQuickOpenFilter}, \l{QuickOpen::FilterEntry}, \l{QuickOpen::BaseFileFilter}
\row
\o
\o
\o
\endtable
*/
......@@ -7,13 +7,15 @@ headerdirs = . \
../../src/libs/aggregation \
../../src/libs/extensionsystem \
../../src/plugins/coreplugin \
../../src/plugins/coreplugin/actionmanager
../../src/plugins/find \
../../src/plugins/quickopen
sourcedirs = . \
../../src/libs/aggregation \
../../src/libs/extensionsystem \
../../src/plugins/coreplugin \
../../src/plugins/coreplugin/actionmanager
../../src/plugins/find \
../../src/plugins/quickopen
headers.fileextesnions = "*.h"
sources.fileextensions = "*.cpp *.qdoc"
......
......@@ -44,3 +44,5 @@ macx {
OTHER_FILES = qtcreator.qdoc \
qtcreator.qdocconf
OTHER_FILES += api/qtcreator-api.qdoc \
api/qtcreator-api.qdocconf
......@@ -36,7 +36,6 @@
/*!
\class Core::Command
\mainclass
\ingroup qwb
\brief The class...
......@@ -197,7 +196,6 @@ QString CommandPrivate::stringWithAppendedShortcut(const QString &str) const
/*!
\class Shortcut
\ingroup qwb
*/
/*!
......@@ -309,7 +307,6 @@ bool Shortcut::isActive() const
/*!
\class Action
\ingroup qwb
*/
/*!
......@@ -401,7 +398,6 @@ QKeySequence Action::keySequence() const
/*!
\class OverrideableAction
\ingroup qwb
*/
/*!
......
......@@ -42,7 +42,6 @@ using namespace Core::Internal;
/*!
\class CommandsFile
\brief The CommandsFile class provides a collection of import and export commands.
\ingroup qwb
\inheaderfile commandsfile.h
*/
......
......@@ -38,7 +38,6 @@ using namespace Core;
/*!
\class BaseMode
\mainclass
\ingroup qwb
\inheaderfile basemode.h
\brief A base implementation of the mode interface IMode.
......
......@@ -33,42 +33,6 @@
using namespace Core;
/*!
\class BaseView
\mainclass
\ingroup qwb
\inheaderfile baseview.h
\brief A base implementation of IView.
The BaseView class can be used directly for most IView implementations.
It has setter functions for the views properties, and a convenience constructor
for the most important ones.
The ownership of the widget is given to the BaseView, so when the BaseView is destroyed it
deletes its widget.
A typical use case is to do the following in the init method of a plugin:
\code
bool MyPlugin::init(QString *error_message)
{
[...]
addObject(new Core::BaseView("myplugin.myview",
new MyWidget,
QList<int>() << myContextId,
Qt::LeftDockWidgetArea,
this));
[...]
}
\endcode
*/
/*!
\fn BaseView::BaseView()
Creates a View with empty view name, no widget, empty context, NoDockWidgetArea,
no menu group and empty default shortcut. You should use the setter functions
to give the view a meaning.
*/
BaseView::BaseView(QObject *parent)
: IView(parent),
m_viewName(""),
......@@ -78,66 +42,37 @@ BaseView::BaseView(QObject *parent)
{
}
/*!
\fn BaseView::~BaseView()
Destructor also destroys the widget.
*/
BaseView::~BaseView()
{
delete m_widget;
}
/*!
\fn const QList<int> &BaseView::context() const
*/
QList<int> BaseView::context() const
{
return m_context;
}
/*!
\fn QWidget *BaseView::widget()
*/
QWidget *BaseView::widget()
{
return m_widget;
}
/*!
\fn const char *BaseView::uniqueViewName() const
*/
const char *BaseView::uniqueViewName() const
{
return m_viewName;
}
/*!
\fn IView::ViewPosition BaseView::defaultPosition() const
*/
IView::ViewPosition BaseView::defaultPosition() const
{
return m_defaultPosition;
}
/*!
\fn void BaseView::setUniqueViewName(const char *name)
\a name
*/
void BaseView::setUniqueViewName(const char *name)
{
m_viewName = name;
}
/*!
\fn QWidget *BaseView::setWidget(QWidget *widget)
The BaseView takes the ownership of the \a widget. The previously
set widget (if existent) is not deleted but returned, and responsibility
for deleting it moves to the caller of this method.
*/
QWidget *BaseView::setWidget(QWidget *widget)
{
QWidget *oldWidget = m_widget;
......@@ -145,21 +80,11 @@ QWidget *BaseView::setWidget(QWidget *widget)
return oldWidget;
}
/*!
\fn void BaseView::setContext(const QList<int> &context)
\a context
*/
void BaseView::setContext(const QList<int> &context)
{
m_context = context;
}
/*!
\fn void BaseView::setDefaultPosition(IView::ViewPosition position)
\a position
*/
void BaseView::setDefaultPosition(IView::ViewPosition position)
{
m_defaultPosition = position;
......
......@@ -4,7 +4,6 @@ DEFINES += CORE_LIBRARY
QT += xml \
script \
svg
include(../../qworkbenchplugin.pri)
include(../../libs/utils/utils.pri)
include(../../shared/scriptwrapper/scriptwrapper.pri)
......@@ -72,7 +71,9 @@ SOURCES += mainwindow.cpp \
sidebar.cpp \
fileiconprovider.cpp \
mimedatabase.cpp \
icore.cpp
icore.cpp \
editormanager/ieditor.cpp \
dialogs/ioptionspage.cpp
HEADERS += mainwindow.h \
welcomemode.h \
welcomemode_p.h \
......@@ -160,12 +161,9 @@ FORMS += dialogs/newdialog.ui \
welcomemode.ui
RESOURCES += core.qrc \
fancyactionbar.qrc
linux-* {
linux-* {
images.files = images/qtcreator_logo_*.png
images.path = /share/pixmaps
images.path = /share/pixmaps
INSTALLS += images
}
OTHER_FILES += Core.pluginspec
......@@ -38,21 +38,6 @@
namespace Core {
/*!
\class Core::IOptionsPage
\brief The IOptionsPage is an interface for providing options pages.
Guidelines for implementing:
\list
\o id() is an id used for filtering when calling ICore:: showOptionsDialog()
\o trName() is the (translated) name for display.
\o category() is the category used for filtering when calling ICore:: showOptionsDialog()
\o trCategory() is the translated category
\o apply() is called to store the settings. It should detect if any changes have been
made and store those.
\endlist
*/
class CORE_EXPORT IOptionsPage : public QObject
{
Q_OBJECT
......
......@@ -40,31 +40,6 @@ QT_END_NAMESPACE
namespace Core {
/*!
\class Core::IEditor
\brief The IEditor is an interface for providing different editors for different file types.
Classes that implement this interface are for example the editors for
C++ files, ui-files and resource files.
Whenever a user wants to edit or create a file, the EditorManager scans all
EditorFactoryInterfaces for suitable editors. The selected EditorFactory
is then asked to create an editor, which must implement this interface.
Guidelines for implementing:
\list
\o displayName() is used as a user visible description of the document (usually filename w/o path).
\o kind() must be the same value as the kind() of the corresponding EditorFactory.
\o The changed() signal should be emitted when the modified state of the document changes
(so /bold{not} every time the document changes, but /bold{only once}).
\o If duplication is supported, you need to ensure that all duplicates
return the same file().
\endlist
\sa Core::EditorFactoryInterface Core::IContext
*/
class CORE_EXPORT IEditor : public IContext
{
Q_OBJECT
......@@ -85,8 +60,8 @@ public:
virtual QByteArray saveState() const = 0;
virtual bool restoreState(const QByteArray &state) = 0;
virtual int currentLine() const { return 0; };
virtual int currentColumn() const { return 0; };
virtual int currentLine() const { return 0; }
virtual int currentColumn() const { return 0; }
virtual QToolBar *toolBar() = 0;
......
......@@ -56,7 +56,6 @@ using namespace Core::Internal;
/*!
\class FileManager
\mainclass
\ingroup qwb
\inheaderfile filemanager.h
\brief Manages a set of IFile objects.
......@@ -549,7 +548,7 @@ void FileManager::saveRecentFiles()
The current file is e.g. the file currently opened when an editor is active,
or the selected file in case a Project Explorer is active ...
\see currentFile
\sa currentFile
*/
void FileManager::setCurrentFile(const QString &filePath)
{
......@@ -565,7 +564,7 @@ void FileManager::setCurrentFile(const QString &filePath)
The current file is e.g. the file currently opened when an editor is active,
or the selected file in case a Project Explorer is active ...
\see setCurrentFile
\sa setCurrentFile
*/
QString FileManager::currentFile() const
{
......
......@@ -75,7 +75,6 @@
#include <QtGui/QTextEdit>
#include <QtGui/QComboBox>
#include <QtGui/QTreeView>
#include <QtGui/QSortFilterProxyModel>
using namespace CPlusPlus;
using namespace CppEditor::Internal;
......@@ -244,22 +243,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
m_methodCombo->setMaxVisibleItems(20);
m_overviewModel = new OverviewModel(this);
m_proxyModel = new QSortFilterProxyModel(this);
m_proxyModel->setSourceModel(m_overviewModel);
if (CppPlugin::instance()->sortedMethodOverview())
m_proxyModel->sort(0, Qt::AscendingOrder);
else
m_proxyModel->sort(-1, Qt::AscendingOrder); // don't sort yet, but set column for sortedMethodOverview()
m_proxyModel->setDynamicSortFilter(true);
m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
m_methodCombo->setModel(m_proxyModel);
m_methodCombo->setContextMenuPolicy(Qt::ActionsContextMenu);
m_sortAction = new QAction(tr("Sort alphabetically"), m_methodCombo);
m_sortAction->setCheckable(true);
m_sortAction->setChecked(sortedMethodOverview());
connect(m_sortAction, SIGNAL(toggled(bool)), CppPlugin::instance(), SLOT(setSortedMethodOverview(bool)));
m_methodCombo->addAction(m_sortAction);
m_methodCombo->setModel(m_overviewModel);
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
......@@ -382,7 +366,7 @@ void CPPEditor::updateFileName()
void CPPEditor::jumpToMethod(int)
{
QModelIndex index = m_proxyModel->mapToSource(m_methodCombo->view()->currentIndex());
QModelIndex index = m_methodCombo->view()->currentIndex();
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
if (! symbol)
return;
......@@ -390,25 +374,6 @@ void CPPEditor::jumpToMethod(int)
openCppEditorAt(linkToSymbol(symbol));
}
void CPPEditor::setSortedMethodOverview(bool sort)
{
if (sort != sortedMethodOverview()) {
if (sort)
m_proxyModel->sort(0, Qt::AscendingOrder);
else
m_proxyModel->sort(-1, Qt::AscendingOrder);
bool block = m_sortAction->blockSignals(true);
m_sortAction->setChecked(m_proxyModel->sortColumn() == 0);
m_sortAction->blockSignals(block);
updateMethodBoxIndex();
}
}
bool CPPEditor::sortedMethodOverview() const
{
return (m_proxyModel->sortColumn() == 0);
}
void CPPEditor::updateMethodBoxIndex()
{
int line = 0, column = 0;
......@@ -429,7 +394,7 @@ void CPPEditor::updateMethodBoxIndex()
if (lastIndex.isValid()) {
bool blocked = m_methodCombo->blockSignals(true);
m_methodCombo->setCurrentIndex(m_proxyModel->mapFromSource(lastIndex).row());
m_methodCombo->setCurrentIndex(lastIndex.row());
updateMethodBoxToolTip();
(void) m_methodCombo->blockSignals(blocked);
}
......
......@@ -37,7 +37,6 @@
QT_BEGIN_NAMESPACE
class QComboBox;
class QSortFilterProxyModel;
QT_END_NAMESPACE
namespace CPlusPlus {
......@@ -87,7 +86,6 @@ public:
public slots:
virtual void setFontSettings(const TextEditor::FontSettings &);
void setSortedMethodOverview(bool sort);
void switchDeclarationDefinition();
void jumpToDefinition();
......@@ -96,6 +94,7 @@ public slots:
void deleteStartOfToken();
void deleteEndOfToken();
protected:
void contextMenuEvent(QContextMenuEvent *);
void mouseMoveEvent(QMouseEvent *);
......@@ -116,7 +115,6 @@ private slots:
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
private:
bool sortedMethodOverview() const;
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
......@@ -163,8 +161,6 @@ private:
QList<int> m_contexts;
QComboBox *m_methodCombo;
CPlusPlus::OverviewModel *m_overviewModel;
QSortFilterProxyModel *m_proxyModel;
QAction *m_sortAction;
};
} // namespace Internal
......
......@@ -106,8 +106,7 @@ CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() :
m_actionHandler(0),
m_factory(0),
m_sortedMethodOverview(false)
m_factory(0)
{
m_instance = this;
}
......@@ -134,20 +133,6 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
// auto completion
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(ITextEditable*, bool)));
// method combo box sorting
connect(this, SIGNAL(methodOverviewSortingChanged(bool)),
editor, SLOT(setSortedMethodOverview(bool)));
}
void CppPlugin::setSortedMethodOverview(bool sorted)
{
m_sortedMethodOverview = sorted;
emit methodOverviewSortingChanged(sorted);
}
bool CppPlugin::sortedMethodOverview() const
{
return m_sortedMethodOverview;
}
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
......@@ -209,30 +194,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
readSettings();
return true;
}
void CppPlugin::readSettings()
{
m_sortedMethodOverview = Core::ICore::instance()->settings()->value("CppTools/SortedMethodOverview", false).toBool();
}
void CppPlugin::writeSettings()
{
Core::ICore::instance()->settings()->setValue("CppTools/SortedMethodOverview", m_sortedMethodOverview);
}
void CppPlugin::extensionsInitialized()
{
m_actionHandler->initializeActions();
}
void CppPlugin::shutdown()
{
writeSettings();
}
void CppPlugin::switchDeclarationDefinition()
{
Core::EditorManager *em = Core::EditorManager::instance();
......
......@@ -58,19 +58,10 @@ public:
bool initialize(const QStringList &arguments, QString *error_message = 0);
void extensionsInitialized();
void shutdown();
// Connect editor to settings changed signals.
void initializeEditor(CPPEditor *editor);
bool sortedMethodOverview() const;
signals:
void methodOverviewSortingChanged(bool sort);
public slots:
void setSortedMethodOverview(bool sorted);
private slots:
void switchDeclarationDefinition();
void jumpToDefinition();
......@@ -78,14 +69,11 @@ private slots:
private:
friend class CppEditorFactory;
Core::IEditor *createEditor(QWidget *parent);
void writeSettings();
void readSettings();
static CppPlugin *m_instance;
TextEditor::TextEditorActionHandler *m_actionHandler;
CppEditorFactory *m_factory;
bool m_sortedMethodOverview;
};
class CppEditorFactory : public Core::IEditorFactory
......
......@@ -47,6 +47,20 @@
#include <QtCore/QtPlugin>
#include <QtCore/QSettings>
/*!
\namespace Find
The Find namespace provides everything that has to do with search term based searches.
*/
/*!
\namespace Find::Internal
\internal
*/
/*!
\namespace Find::Internal::ItemDataRoles
\internal
*/
Q_DECLARE_METATYPE(Find::IFindFilter*)
namespace {
......
......@@ -51,10 +51,18 @@
#include <extensionsystem/pluginmanager.h>
#include <qtconcurrent/QtConcurrentTools>
/*!
\namespace QuickOpen
The QuickOpen namespace provides the hooks for Locator content.
*/
/*!
\namespace QuickOpen::Internal
\internal
*/
using namespace QuickOpen;
using namespace QuickOpen::Internal;
namespace {
static bool filterLessThan(const IQuickOpenFilter *first, const IQuickOpenFilter *second)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment