forked from qt-creator/qt-creator
Some documentation.
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
simple means for plugin cooperation that allow plugins to provide
|
simple means for plugin cooperation that allow plugins to provide
|
||||||
hooks for other plugin's extensions.
|
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
|
\section1 Core Libraries
|
||||||
|
|
||||||
There are a few core libraries used by many parts of Qt Creator.
|
There are a few core libraries used by many parts of Qt Creator.
|
||||||
@@ -19,12 +21,12 @@
|
|||||||
\o Description
|
\o Description
|
||||||
|
|
||||||
\row
|
\row
|
||||||
\o \l{Aggregation}{Aggregation}
|
\o \l{Aggregation}
|
||||||
\o Adds functionality for "glueing" QObjects of different
|
\o Adds functionality for "glueing" QObjects of different
|
||||||
types together, so you can "cast" between them.
|
types together, so you can "cast" between them.
|
||||||
|
|
||||||
\row
|
\row
|
||||||
\o \l{ExtensionSystem}{ExtensionSystem}
|
\o \l{ExtensionSystem}
|
||||||
\o Implements the plugin loader framework. Provides a base class for plugins and
|
\o Implements the plugin loader framework. Provides a base class for plugins and
|
||||||
basic mechanisms for plugin interaction like an object pool.
|
basic mechanisms for plugin interaction like an object pool.
|
||||||
|
|
||||||
@@ -43,10 +45,18 @@
|
|||||||
\o Description
|
\o Description
|
||||||
|
|
||||||
\row
|
\row
|
||||||
\o \l{Core} {Core}
|
\o \l{Core}
|
||||||
\o The core plugin. Provides the main window and managers for editors,
|
\o The core plugin. Provides the main window and managers for editors,
|
||||||
actions, mode windows and files, just to mention the most important ones.
|
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
|
\endtable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -79,3 +89,85 @@
|
|||||||
\generatelist functionindex
|
\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/aggregation \
|
||||||
../../src/libs/extensionsystem \
|
../../src/libs/extensionsystem \
|
||||||
../../src/plugins/coreplugin \
|
../../src/plugins/coreplugin \
|
||||||
../../src/plugins/coreplugin/actionmanager
|
../../src/plugins/find \
|
||||||
|
../../src/plugins/quickopen
|
||||||
|
|
||||||
sourcedirs = . \
|
sourcedirs = . \
|
||||||
../../src/libs/aggregation \
|
../../src/libs/aggregation \
|
||||||
../../src/libs/extensionsystem \
|
../../src/libs/extensionsystem \
|
||||||
../../src/plugins/coreplugin \
|
../../src/plugins/coreplugin \
|
||||||
../../src/plugins/coreplugin/actionmanager
|
../../src/plugins/find \
|
||||||
|
../../src/plugins/quickopen
|
||||||
|
|
||||||
headers.fileextesnions = "*.h"
|
headers.fileextesnions = "*.h"
|
||||||
sources.fileextensions = "*.cpp *.qdoc"
|
sources.fileextensions = "*.cpp *.qdoc"
|
||||||
|
|||||||
@@ -44,3 +44,5 @@ macx {
|
|||||||
|
|
||||||
OTHER_FILES = qtcreator.qdoc \
|
OTHER_FILES = qtcreator.qdoc \
|
||||||
qtcreator.qdocconf
|
qtcreator.qdocconf
|
||||||
|
OTHER_FILES += api/qtcreator-api.qdoc \
|
||||||
|
api/qtcreator-api.qdocconf
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
/*!
|
/*!
|
||||||
\class Core::Command
|
\class Core::Command
|
||||||
\mainclass
|
\mainclass
|
||||||
\ingroup qwb
|
|
||||||
|
|
||||||
\brief The class...
|
\brief The class...
|
||||||
|
|
||||||
@@ -197,7 +196,6 @@ QString CommandPrivate::stringWithAppendedShortcut(const QString &str) const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Shortcut
|
\class Shortcut
|
||||||
\ingroup qwb
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -309,7 +307,6 @@ bool Shortcut::isActive() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Action
|
\class Action
|
||||||
\ingroup qwb
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -401,7 +398,6 @@ QKeySequence Action::keySequence() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class OverrideableAction
|
\class OverrideableAction
|
||||||
\ingroup qwb
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ using namespace Core::Internal;
|
|||||||
/*!
|
/*!
|
||||||
\class CommandsFile
|
\class CommandsFile
|
||||||
\brief The CommandsFile class provides a collection of import and export commands.
|
\brief The CommandsFile class provides a collection of import and export commands.
|
||||||
\ingroup qwb
|
|
||||||
\inheaderfile commandsfile.h
|
\inheaderfile commandsfile.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ using namespace Core;
|
|||||||
/*!
|
/*!
|
||||||
\class BaseMode
|
\class BaseMode
|
||||||
\mainclass
|
\mainclass
|
||||||
\ingroup qwb
|
|
||||||
\inheaderfile basemode.h
|
\inheaderfile basemode.h
|
||||||
\brief A base implementation of the mode interface IMode.
|
\brief A base implementation of the mode interface IMode.
|
||||||
|
|
||||||
|
|||||||
@@ -33,42 +33,6 @@
|
|||||||
|
|
||||||
using namespace Core;
|
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)
|
BaseView::BaseView(QObject *parent)
|
||||||
: IView(parent),
|
: IView(parent),
|
||||||
m_viewName(""),
|
m_viewName(""),
|
||||||
@@ -78,66 +42,37 @@ BaseView::BaseView(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn BaseView::~BaseView()
|
|
||||||
|
|
||||||
Destructor also destroys the widget.
|
|
||||||
*/
|
|
||||||
BaseView::~BaseView()
|
BaseView::~BaseView()
|
||||||
{
|
{
|
||||||
delete m_widget;
|
delete m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn const QList<int> &BaseView::context() const
|
|
||||||
*/
|
|
||||||
QList<int> BaseView::context() const
|
QList<int> BaseView::context() const
|
||||||
{
|
{
|
||||||
return m_context;
|
return m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QWidget *BaseView::widget()
|
|
||||||
*/
|
|
||||||
QWidget *BaseView::widget()
|
QWidget *BaseView::widget()
|
||||||
{
|
{
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn const char *BaseView::uniqueViewName() const
|
|
||||||
*/
|
|
||||||
const char *BaseView::uniqueViewName() const
|
const char *BaseView::uniqueViewName() const
|
||||||
{
|
{
|
||||||
return m_viewName;
|
return m_viewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn IView::ViewPosition BaseView::defaultPosition() const
|
|
||||||
*/
|
|
||||||
IView::ViewPosition BaseView::defaultPosition() const
|
IView::ViewPosition BaseView::defaultPosition() const
|
||||||
{
|
{
|
||||||
return m_defaultPosition;
|
return m_defaultPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void BaseView::setUniqueViewName(const char *name)
|
|
||||||
|
|
||||||
\a name
|
|
||||||
*/
|
|
||||||
void BaseView::setUniqueViewName(const char *name)
|
void BaseView::setUniqueViewName(const char *name)
|
||||||
{
|
{
|
||||||
m_viewName = 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 *BaseView::setWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
QWidget *oldWidget = m_widget;
|
QWidget *oldWidget = m_widget;
|
||||||
@@ -145,21 +80,11 @@ QWidget *BaseView::setWidget(QWidget *widget)
|
|||||||
return oldWidget;
|
return oldWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void BaseView::setContext(const QList<int> &context)
|
|
||||||
|
|
||||||
\a context
|
|
||||||
*/
|
|
||||||
void BaseView::setContext(const QList<int> &context)
|
void BaseView::setContext(const QList<int> &context)
|
||||||
{
|
{
|
||||||
m_context = context;
|
m_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void BaseView::setDefaultPosition(IView::ViewPosition position)
|
|
||||||
|
|
||||||
\a position
|
|
||||||
*/
|
|
||||||
void BaseView::setDefaultPosition(IView::ViewPosition position)
|
void BaseView::setDefaultPosition(IView::ViewPosition position)
|
||||||
{
|
{
|
||||||
m_defaultPosition = position;
|
m_defaultPosition = position;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ DEFINES += CORE_LIBRARY
|
|||||||
QT += xml \
|
QT += xml \
|
||||||
script \
|
script \
|
||||||
svg
|
svg
|
||||||
|
|
||||||
include(../../qworkbenchplugin.pri)
|
include(../../qworkbenchplugin.pri)
|
||||||
include(../../libs/utils/utils.pri)
|
include(../../libs/utils/utils.pri)
|
||||||
include(../../shared/scriptwrapper/scriptwrapper.pri)
|
include(../../shared/scriptwrapper/scriptwrapper.pri)
|
||||||
@@ -72,7 +71,9 @@ SOURCES += mainwindow.cpp \
|
|||||||
sidebar.cpp \
|
sidebar.cpp \
|
||||||
fileiconprovider.cpp \
|
fileiconprovider.cpp \
|
||||||
mimedatabase.cpp \
|
mimedatabase.cpp \
|
||||||
icore.cpp
|
icore.cpp \
|
||||||
|
editormanager/ieditor.cpp \
|
||||||
|
dialogs/ioptionspage.cpp
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
welcomemode.h \
|
welcomemode.h \
|
||||||
welcomemode_p.h \
|
welcomemode_p.h \
|
||||||
@@ -160,12 +161,9 @@ FORMS += dialogs/newdialog.ui \
|
|||||||
welcomemode.ui
|
welcomemode.ui
|
||||||
RESOURCES += core.qrc \
|
RESOURCES += core.qrc \
|
||||||
fancyactionbar.qrc
|
fancyactionbar.qrc
|
||||||
|
linux-* {
|
||||||
linux-* {
|
|
||||||
images.files = images/qtcreator_logo_*.png
|
images.files = images/qtcreator_logo_*.png
|
||||||
images.path = /share/pixmaps
|
images.path = /share/pixmaps
|
||||||
|
|
||||||
INSTALLS += images
|
INSTALLS += images
|
||||||
}
|
}
|
||||||
|
|
||||||
OTHER_FILES += Core.pluginspec
|
OTHER_FILES += Core.pluginspec
|
||||||
|
|||||||
@@ -38,21 +38,6 @@
|
|||||||
|
|
||||||
namespace Core {
|
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
|
class CORE_EXPORT IOptionsPage : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -40,31 +40,6 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Core {
|
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
|
class CORE_EXPORT IEditor : public IContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -85,8 +60,8 @@ public:
|
|||||||
virtual QByteArray saveState() const = 0;
|
virtual QByteArray saveState() const = 0;
|
||||||
virtual bool restoreState(const QByteArray &state) = 0;
|
virtual bool restoreState(const QByteArray &state) = 0;
|
||||||
|
|
||||||
virtual int currentLine() const { return 0; };
|
virtual int currentLine() const { return 0; }
|
||||||
virtual int currentColumn() const { return 0; };
|
virtual int currentColumn() const { return 0; }
|
||||||
|
|
||||||
virtual QToolBar *toolBar() = 0;
|
virtual QToolBar *toolBar() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ using namespace Core::Internal;
|
|||||||
/*!
|
/*!
|
||||||
\class FileManager
|
\class FileManager
|
||||||
\mainclass
|
\mainclass
|
||||||
\ingroup qwb
|
|
||||||
\inheaderfile filemanager.h
|
\inheaderfile filemanager.h
|
||||||
\brief Manages a set of IFile objects.
|
\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,
|
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 ...
|
or the selected file in case a Project Explorer is active ...
|
||||||
|
|
||||||
\see currentFile
|
\sa currentFile
|
||||||
*/
|
*/
|
||||||
void FileManager::setCurrentFile(const QString &filePath)
|
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,
|
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 ...
|
or the selected file in case a Project Explorer is active ...
|
||||||
|
|
||||||
\see setCurrentFile
|
\sa setCurrentFile
|
||||||
*/
|
*/
|
||||||
QString FileManager::currentFile() const
|
QString FileManager::currentFile() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
#include <QtGui/QTextEdit>
|
#include <QtGui/QTextEdit>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
#include <QtGui/QSortFilterProxyModel>
|
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
@@ -244,22 +243,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
|
|||||||
m_methodCombo->setMaxVisibleItems(20);
|
m_methodCombo->setMaxVisibleItems(20);
|
||||||
|
|
||||||
m_overviewModel = new OverviewModel(this);
|
m_overviewModel = new OverviewModel(this);
|
||||||
m_proxyModel = new QSortFilterProxyModel(this);
|
m_methodCombo->setModel(m_overviewModel);
|
||||||
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);
|
|
||||||
|
|
||||||
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
|
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
|
||||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
|
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
|
||||||
@@ -382,7 +366,7 @@ void CPPEditor::updateFileName()
|
|||||||
|
|
||||||
void CPPEditor::jumpToMethod(int)
|
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);
|
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
||||||
if (! symbol)
|
if (! symbol)
|
||||||
return;
|
return;
|
||||||
@@ -390,25 +374,6 @@ void CPPEditor::jumpToMethod(int)
|
|||||||
openCppEditorAt(linkToSymbol(symbol));
|
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()
|
void CPPEditor::updateMethodBoxIndex()
|
||||||
{
|
{
|
||||||
int line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
@@ -429,7 +394,7 @@ void CPPEditor::updateMethodBoxIndex()
|
|||||||
|
|
||||||
if (lastIndex.isValid()) {
|
if (lastIndex.isValid()) {
|
||||||
bool blocked = m_methodCombo->blockSignals(true);
|
bool blocked = m_methodCombo->blockSignals(true);
|
||||||
m_methodCombo->setCurrentIndex(m_proxyModel->mapFromSource(lastIndex).row());
|
m_methodCombo->setCurrentIndex(lastIndex.row());
|
||||||
updateMethodBoxToolTip();
|
updateMethodBoxToolTip();
|
||||||
(void) m_methodCombo->blockSignals(blocked);
|
(void) m_methodCombo->blockSignals(blocked);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QSortFilterProxyModel;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
@@ -87,7 +86,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setFontSettings(const TextEditor::FontSettings &);
|
virtual void setFontSettings(const TextEditor::FontSettings &);
|
||||||
void setSortedMethodOverview(bool sort);
|
|
||||||
void switchDeclarationDefinition();
|
void switchDeclarationDefinition();
|
||||||
void jumpToDefinition();
|
void jumpToDefinition();
|
||||||
|
|
||||||
@@ -96,6 +94,7 @@ public slots:
|
|||||||
|
|
||||||
void deleteStartOfToken();
|
void deleteStartOfToken();
|
||||||
void deleteEndOfToken();
|
void deleteEndOfToken();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *);
|
void contextMenuEvent(QContextMenuEvent *);
|
||||||
void mouseMoveEvent(QMouseEvent *);
|
void mouseMoveEvent(QMouseEvent *);
|
||||||
@@ -116,7 +115,6 @@ private slots:
|
|||||||
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool sortedMethodOverview() const;
|
|
||||||
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
||||||
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
||||||
|
|
||||||
@@ -163,8 +161,6 @@ private:
|
|||||||
QList<int> m_contexts;
|
QList<int> m_contexts;
|
||||||
QComboBox *m_methodCombo;
|
QComboBox *m_methodCombo;
|
||||||
CPlusPlus::OverviewModel *m_overviewModel;
|
CPlusPlus::OverviewModel *m_overviewModel;
|
||||||
QSortFilterProxyModel *m_proxyModel;
|
|
||||||
QAction *m_sortAction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ CppPlugin *CppPlugin::m_instance = 0;
|
|||||||
|
|
||||||
CppPlugin::CppPlugin() :
|
CppPlugin::CppPlugin() :
|
||||||
m_actionHandler(0),
|
m_actionHandler(0),
|
||||||
m_factory(0),
|
m_factory(0)
|
||||||
m_sortedMethodOverview(false)
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
}
|
}
|
||||||
@@ -134,20 +133,6 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
|
|||||||
// auto completion
|
// auto completion
|
||||||
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
|
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
|
||||||
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(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)
|
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::UnCommentSelection
|
||||||
| TextEditor::TextEditorActionHandler::UnCollapseAll);
|
| TextEditor::TextEditorActionHandler::UnCollapseAll);
|
||||||
|
|
||||||
readSettings();
|
|
||||||
return true;
|
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()
|
void CppPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
m_actionHandler->initializeActions();
|
m_actionHandler->initializeActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPlugin::shutdown()
|
|
||||||
{
|
|
||||||
writeSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppPlugin::switchDeclarationDefinition()
|
void CppPlugin::switchDeclarationDefinition()
|
||||||
{
|
{
|
||||||
Core::EditorManager *em = Core::EditorManager::instance();
|
Core::EditorManager *em = Core::EditorManager::instance();
|
||||||
|
|||||||
@@ -58,19 +58,10 @@ public:
|
|||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *error_message = 0);
|
bool initialize(const QStringList &arguments, QString *error_message = 0);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
void shutdown();
|
|
||||||
|
|
||||||
// Connect editor to settings changed signals.
|
// Connect editor to settings changed signals.
|
||||||
void initializeEditor(CPPEditor *editor);
|
void initializeEditor(CPPEditor *editor);
|
||||||
|
|
||||||
bool sortedMethodOverview() const;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void methodOverviewSortingChanged(bool sort);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setSortedMethodOverview(bool sorted);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void switchDeclarationDefinition();
|
void switchDeclarationDefinition();
|
||||||
void jumpToDefinition();
|
void jumpToDefinition();
|
||||||
@@ -78,14 +69,11 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
friend class CppEditorFactory;
|
friend class CppEditorFactory;
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
void writeSettings();
|
|
||||||
void readSettings();
|
|
||||||
|
|
||||||
static CppPlugin *m_instance;
|
static CppPlugin *m_instance;
|
||||||
|
|
||||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||||
CppEditorFactory *m_factory;
|
CppEditorFactory *m_factory;
|
||||||
bool m_sortedMethodOverview;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CppEditorFactory : public Core::IEditorFactory
|
class CppEditorFactory : public Core::IEditorFactory
|
||||||
|
|||||||
@@ -47,6 +47,20 @@
|
|||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
#include <QtCore/QSettings>
|
#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*)
|
Q_DECLARE_METATYPE(Find::IFindFilter*)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
@@ -51,10 +51,18 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <qtconcurrent/QtConcurrentTools>
|
#include <qtconcurrent/QtConcurrentTools>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\namespace QuickOpen
|
||||||
|
The QuickOpen namespace provides the hooks for Locator content.
|
||||||
|
*/
|
||||||
|
/*!
|
||||||
|
\namespace QuickOpen::Internal
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
using namespace QuickOpen;
|
using namespace QuickOpen;
|
||||||
using namespace QuickOpen::Internal;
|
using namespace QuickOpen::Internal;
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static bool filterLessThan(const IQuickOpenFilter *first, const IQuickOpenFilter *second)
|
static bool filterLessThan(const IQuickOpenFilter *first, const IQuickOpenFilter *second)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user