forked from qt-creator/qt-creator
Fixes: - API documentation for ICore
Details: - And do some simplification/consistency.
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
Qt Creator is Qt Software's crossplatform IDE. The core of Qt Creator is
|
||||
basically only a \l{ExtensionSystem}{plugin loader}.
|
||||
All functionality is implemented in plugins, the basis of Qt Creator is
|
||||
implemented in the \l{Core} {Core} Plugin. The plugin manager provides
|
||||
simple means for plugin cooperation that allow plugins to provide
|
||||
hooks for other plugin's extensions.
|
||||
|
||||
\section1 Core Libraries
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ language = Cpp
|
||||
headerdirs = . \
|
||||
../../src/libs/aggregation \
|
||||
../../src/libs/extensionsystem \
|
||||
../../src/plugins/core \
|
||||
../../src/plugins/core/actionmanager
|
||||
../../src/plugins/coreplugin \
|
||||
../../src/plugins/coreplugin/actionmanager
|
||||
|
||||
sourcedirs = . \
|
||||
../../src/libs/aggregation \
|
||||
../../src/libs/extensionsystem \
|
||||
../../src/plugins/core \
|
||||
../../src/plugins/core/actionmanager
|
||||
../../src/plugins/coreplugin \
|
||||
../../src/plugins/coreplugin/actionmanager
|
||||
|
||||
headers.fileextesnions = "*.h"
|
||||
sources.fileextensions = "*.cpp *.qdoc"
|
||||
|
||||
@@ -54,8 +54,7 @@ enum { debugLeaks = 0 };
|
||||
|
||||
/*!
|
||||
\namespace ExtensionSystem
|
||||
\brief The ExtensionSystem namespace provides
|
||||
classes that belong to the core plugin system.
|
||||
\brief The ExtensionSystem namespace provides classes that belong to the core plugin system.
|
||||
|
||||
The basic extension system contains of the plugin manager and its supporting classes,
|
||||
and the IPlugin interface that must be implemented by plugin providers.
|
||||
|
||||
@@ -84,11 +84,6 @@ MessageManager *CoreImpl::messageManager() const
|
||||
return m_mainwindow->messageManager();
|
||||
}
|
||||
|
||||
ViewManagerInterface *CoreImpl::viewManager() const
|
||||
{
|
||||
return m_mainwindow->viewManager();
|
||||
}
|
||||
|
||||
ExtensionSystem::PluginManager *CoreImpl::pluginManager() const
|
||||
{
|
||||
return m_mainwindow->pluginManager();
|
||||
@@ -148,15 +143,6 @@ QString CoreImpl::resourcePath() const
|
||||
#endif
|
||||
}
|
||||
|
||||
QString CoreImpl::libraryPath() const
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
return QDir::cleanPath(QCoreApplication::applicationDirPath()+QLatin1String("/../PlugIns"));
|
||||
#else
|
||||
return QDir::cleanPath(QCoreApplication::applicationDirPath()+QLatin1String("/../lib"));
|
||||
#endif
|
||||
}
|
||||
|
||||
IContext *CoreImpl::currentContextObject() const
|
||||
{
|
||||
return m_mainwindow->currentContextObject();
|
||||
@@ -168,12 +154,6 @@ QMainWindow *CoreImpl::mainWindow() const
|
||||
return m_mainwindow;
|
||||
}
|
||||
|
||||
QStatusBar *CoreImpl::statusBar() const
|
||||
{
|
||||
return m_mainwindow->statusBar();
|
||||
}
|
||||
|
||||
|
||||
// adds and removes additional active contexts, this context is appended to the
|
||||
// currently active contexts. call updateContext after changing
|
||||
void CoreImpl::addAdditionalContext(int context)
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
FileManager *fileManager() const ;
|
||||
UniqueIDManager *uniqueIDManager() const;
|
||||
MessageManager *messageManager() const;
|
||||
ViewManagerInterface *viewManager() const;
|
||||
ExtensionSystem::PluginManager *pluginManager() const;
|
||||
EditorManager *editorManager() const;
|
||||
ProgressManagerInterface *progressManager() const;
|
||||
@@ -74,12 +73,10 @@ public:
|
||||
QPrinter *printer() const;
|
||||
|
||||
QString resourcePath() const;
|
||||
QString libraryPath() const;
|
||||
|
||||
IContext *currentContextObject() const;
|
||||
|
||||
QMainWindow *mainWindow() const;
|
||||
QStatusBar *statusBar() const;
|
||||
|
||||
// adds and removes additional active contexts, this context is appended to the
|
||||
// currently active contexts. call updateContext after changing
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "editormanager.h"
|
||||
#include "mainwindow.h"
|
||||
#include "modemanager.h"
|
||||
#include "viewmanager.h"
|
||||
#include "fileiconprovider.h"
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
include(coreplugin_dependencies.pri)
|
||||
|
||||
LIBS *= -l$$qtLibraryTarget(Core)
|
||||
|
||||
@@ -73,7 +73,8 @@ SOURCES += mainwindow.cpp \
|
||||
rightpane.cpp \
|
||||
sidebar.cpp \
|
||||
fileiconprovider.cpp \
|
||||
mimedatabase.cpp
|
||||
mimedatabase.cpp \
|
||||
icore.cpp
|
||||
HEADERS += mainwindow.h \
|
||||
welcomemode.h \
|
||||
editmode.h \
|
||||
|
||||
308
src/plugins/coreplugin/icore.cpp
Normal file
308
src/plugins/coreplugin/icore.cpp
Normal file
@@ -0,0 +1,308 @@
|
||||
#include "icore.h"
|
||||
|
||||
/*!
|
||||
\namespace Core
|
||||
\brief The Core namespace contains all classes that make up the Core plugin
|
||||
which constitute the basic functionality of Qt Creator.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\namespace Core::Internal
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class Core::ICore
|
||||
\brief The ICore class allows access to the different part that make up
|
||||
the basic functionality of Qt Creator.
|
||||
|
||||
You should never create a subclass of this interface. The one and only
|
||||
instance is created by the Core plugin. You can access this instance
|
||||
from your plugin via the plugin manager, e.g.
|
||||
\code
|
||||
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
\endcode
|
||||
|
||||
\mainclass
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringList ICore::showNewItemDialog(const QString &title,
|
||||
const QList<IWizard *> &wizards,
|
||||
const QString &defaultLocation = QString())
|
||||
\brief Opens a dialog where the user can choose from a set of \a wizards that
|
||||
create new files/classes/projects.
|
||||
|
||||
The \a title argument is shown as the dialogs title. The path where the
|
||||
files will be created (if the user doesn't change it) is set
|
||||
in \a defaultLocation. It defaults to the path of the file manager's
|
||||
current file.
|
||||
|
||||
\sa Core::FileManager
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::showOptionsDialog(const QString &group = QString(),
|
||||
const QString &page = QString())
|
||||
\brief Opens the application options/preferences dialog with preselected
|
||||
\a page in a specified \a group.
|
||||
|
||||
The arguments refer to the string IDs of the corresponding IOptionsPage.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ActionManagerInterface *ICore::actionManager() const
|
||||
\brief Returns the application's action manager.
|
||||
|
||||
The action manager is responsible for registration of menus and
|
||||
menu items and keyboard shortcuts.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn FileManager *ICore::fileManager() const
|
||||
\brief Returns the application's file manager.
|
||||
|
||||
The file manager keeps track of files for changes outside the application.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn UniqueIDManager *ICore::uniqueIDManager() const
|
||||
\brief Returns the application's id manager.
|
||||
|
||||
The unique ID manager transforms strings in unique integers and the other way round.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn MessageManager *ICore::messageManager() const
|
||||
\brief Returns the application's message manager.
|
||||
|
||||
The message manager is the interface to the "General" output pane for
|
||||
general application debug messages.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ExtensionSystem::PluginManager *ICore::pluginManager() const
|
||||
\brief Returns the application's plugin manager.
|
||||
|
||||
The plugin manager handles the plugin life cycles and manages
|
||||
the common object pool.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn EditorManager *ICore::editorManager() const
|
||||
\brief Returns the application's editor manager.
|
||||
|
||||
The editor manager handles all editor related tasks like opening
|
||||
documents, the stack of currently open documents and the currently
|
||||
active document.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ProgressManagerInterface *ICore::progressManager() const
|
||||
\brief Returns the application's progress manager.
|
||||
|
||||
Use the progress manager to register a concurrent task to
|
||||
show a progress bar the way Qt Creator does it.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ScriptManagerInterface *ICore::scriptManager() const
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn VariableManager *ICore::variableManager() const
|
||||
\brief Returns the application's variable manager.
|
||||
|
||||
The variable manager is used to register application wide string variables
|
||||
like \c MY_PROJECT_DIR such that strings like \c{somecommand ${MY_PROJECT_DIR}/sub}
|
||||
can be resolved/expanded from anywhere in the application.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn VCSManager *ICore::vcsManager() const
|
||||
\brief Returns the application's vcs manager.
|
||||
|
||||
The vcs manager can be used to e.g. retrieve information about
|
||||
the version control system used for a directory on hard disk.
|
||||
The actual functionality for a specific version control system
|
||||
must be implemented in a IVersionControl object and registered in
|
||||
the plugin manager's object pool.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ModeManager *ICore::modeManager() const
|
||||
\brief Returns the application's mode manager.
|
||||
|
||||
The mode manager handles everything related to the instances of IMode
|
||||
that were added to the plugin manager's object pool as well as their
|
||||
buttons and the tool bar with the round buttons in the lower left
|
||||
corner of Qt Creator.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn MimeDatabase *ICore::mimeDatabase() const
|
||||
\brief Returns the application's mime database.
|
||||
|
||||
Use the mime database to manage mime types.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QSettings *ICore::settings() const
|
||||
\brief Returns the application's main settings object.
|
||||
|
||||
You can use it to retrieve or set application wide settings
|
||||
(in contrast to session or project specific settings).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPrinter *ICore::printer() const
|
||||
\brief Returns the application's printer object.
|
||||
|
||||
Always use this printer object for printing, so the different parts of the
|
||||
application re-use it's settings.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString ICore::resourcePath() const
|
||||
\brief Returns the absolute path that is used for resources like
|
||||
project templates and the debugger macros.
|
||||
|
||||
This abstraction is needed to avoid platform-specific code all over
|
||||
the place, since e.g. on Mac the resources are part of the application bundle.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QMainWindow *ICore::mainWindow() const
|
||||
\brief Returns the main application window.
|
||||
|
||||
For use as dialog parent etc.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn IContext *ICore::currentContextObject() const
|
||||
\brief Returns the context object of the current main context.
|
||||
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::addContextObject()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::addAdditionalContext(int context)
|
||||
\brief Register additional context to be currently active.
|
||||
|
||||
Appends the additional \a context to the list of currently active
|
||||
contexts. You need to call ICore::updateContext to make that change
|
||||
take effect.
|
||||
|
||||
\sa ICore::removeAdditionalContext()
|
||||
\sa ICore::hasContext()
|
||||
\sa ICore::updateContext()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::removeAdditionalContext(int context)
|
||||
\brief Removes the given \a context from the list of currently active contexts.
|
||||
|
||||
You need to call ICore::updateContext to make that change
|
||||
take effect.
|
||||
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::hasContext()
|
||||
\sa ICore::updateContext()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool ICore::hasContext(int context) const
|
||||
\brief Returns if the given \a context is currently one of the active contexts.
|
||||
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::addContextObject()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::addContextObject(IContext *context)
|
||||
\brief Registers an additional \a context object.
|
||||
|
||||
After registration this context object gets automatically the
|
||||
current context object whenever it's widget gets focus.
|
||||
|
||||
\sa ICore::removeContextObject()
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::currentContextObject()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::removeContextObject(IContext *context)
|
||||
\brief Unregisters a \a context object from the list of know contexts.
|
||||
|
||||
\sa ICore::addContextObject()
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::currentContextObject()
|
||||
}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::updateContext()
|
||||
\brief Update the list of active contexts after adding or removing additional ones.
|
||||
|
||||
\sa ICore::addAdditionalContext()
|
||||
\sa ICore::removeAdditionalContext()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::openFiles(const QStringList &fileNames)
|
||||
\brief Open all files from a list of \a fileNames like it would be
|
||||
done if they were given to Qt Creator on the command line, or
|
||||
they were opened via \gui{File|Open}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ICore::ICore()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ICore::~ICore()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::coreOpened()
|
||||
\brief Emitted after all plugins have been loaded and the main window shown.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::saveSettingsRequested()
|
||||
\brief Emitted to signal that the user has requested that the global settings
|
||||
should be saved to disk.
|
||||
|
||||
At the moment that happens when the application is closed, and on \gui{Save All}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::optionsDialogRequested()
|
||||
\brief Signal that allows plugins to perform actions just before the \gui{Tools|Options}
|
||||
dialog is shown.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::coreAboutToClose()
|
||||
\brief Plugins can do some pre-end-of-life actions when they get this signal.
|
||||
|
||||
The application is guaranteed to shut down after this signal is emitted.
|
||||
It's there as an addition to the usual plugin lifecycle methods, namely
|
||||
IPlugin::shutdown(), just for convenience.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::contextAboutToChange(Core::IContext *context)
|
||||
\brief Sent just before a new \a context becomes the current context
|
||||
(meaning that it's widget got focus).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICore::contextChanged(Core::IContext *context)
|
||||
\brief Sent just after a new \a context became the current context
|
||||
(meaning that it's widget got focus).
|
||||
*/
|
||||
@@ -56,7 +56,6 @@ class FileManager;
|
||||
class MessageManager;
|
||||
class IEditor;
|
||||
class UniqueIDManager;
|
||||
class ViewManagerInterface;
|
||||
class EditorManager;
|
||||
class ProgressManagerInterface;
|
||||
class ScriptManagerInterface;
|
||||
@@ -86,7 +85,6 @@ public:
|
||||
virtual FileManager *fileManager() const = 0;
|
||||
virtual UniqueIDManager *uniqueIDManager() const = 0;
|
||||
virtual MessageManager *messageManager() const = 0;
|
||||
virtual ViewManagerInterface *viewManager() const = 0;
|
||||
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
|
||||
virtual EditorManager *editorManager() const = 0;
|
||||
virtual ProgressManagerInterface *progressManager() const = 0;
|
||||
@@ -100,20 +98,17 @@ public:
|
||||
virtual QPrinter *printer() const = 0;
|
||||
|
||||
virtual QString resourcePath() const = 0;
|
||||
virtual QString libraryPath() const = 0;
|
||||
|
||||
virtual IContext *currentContextObject() const = 0;
|
||||
|
||||
virtual QMainWindow *mainWindow() const = 0;
|
||||
virtual QStatusBar *statusBar() const = 0;
|
||||
|
||||
// adds and removes additional active contexts, this context is appended to the
|
||||
// currently active contexts. call updateContext after changing
|
||||
virtual IContext *currentContextObject() const = 0;
|
||||
virtual void addAdditionalContext(int context) = 0;
|
||||
virtual void removeAdditionalContext(int context) = 0;
|
||||
virtual bool hasContext(int context) const = 0;
|
||||
virtual void addContextObject(IContext *contex) = 0;
|
||||
virtual void removeContextObject(IContext *contex) = 0;
|
||||
virtual void addContextObject(IContext *context) = 0;
|
||||
virtual void removeContextObject(IContext *context) = 0;
|
||||
|
||||
virtual void updateContext() = 0;
|
||||
|
||||
@@ -122,7 +117,7 @@ public:
|
||||
signals:
|
||||
void coreOpened();
|
||||
void saveSettingsRequested();
|
||||
void settingsDialogRequested();
|
||||
void optionsDialogRequested();
|
||||
void coreAboutToClose();
|
||||
void contextAboutToChange(Core::IContext *context);
|
||||
void contextChanged(Core::IContext *context);
|
||||
|
||||
@@ -783,7 +783,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
|
||||
|
||||
void MainWindow::showOptionsDialog(const QString &category, const QString &page)
|
||||
{
|
||||
emit m_coreImpl->settingsDialogRequested();
|
||||
emit m_coreImpl->optionsDialogRequested();
|
||||
SettingsDialog dlg(this, category, page);
|
||||
dlg.exec();
|
||||
}
|
||||
@@ -840,11 +840,6 @@ VCSManager *MainWindow::vcsManager() const
|
||||
return m_vcsManager;
|
||||
}
|
||||
|
||||
ViewManagerInterface *MainWindow::viewManager() const
|
||||
{
|
||||
return m_viewManager;
|
||||
}
|
||||
|
||||
EditorManager *MainWindow::editorManager() const
|
||||
{
|
||||
return m_editorManager;
|
||||
|
||||
@@ -109,7 +109,6 @@ public:
|
||||
Core::FileManager *fileManager() const;
|
||||
Core::UniqueIDManager *uniqueIDManager() const;
|
||||
Core::MessageManager *messageManager() const;
|
||||
Core::ViewManagerInterface *viewManager() const;
|
||||
ExtensionSystem::PluginManager *pluginManager() const;
|
||||
Core::EditorManager *editorManager() const;
|
||||
Core::ProgressManagerInterface *progressManager() const;
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "coreconstants.h"
|
||||
#include "uniqueidmanager.h"
|
||||
#include "viewmanagerinterface.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
#include <QtScript/QScriptEngine>
|
||||
@@ -82,11 +81,6 @@ QMainWindow *CorePrototype::mainWindow() const
|
||||
return callee()->mainWindow();
|
||||
}
|
||||
|
||||
QStatusBar *CorePrototype::statusBar() const
|
||||
{
|
||||
return callee()->statusBar();
|
||||
}
|
||||
|
||||
QSettings *CorePrototype::settings() const
|
||||
{
|
||||
return callee()->settings();
|
||||
|
||||
@@ -55,7 +55,6 @@ class CorePrototype : public QObject, public QScriptable
|
||||
Q_PROPERTY(Core::EditorManager* editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false)
|
||||
|
||||
Q_PROPERTY(QMainWindow* mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false)
|
||||
Q_PROPERTY(QStatusBar* statusBar READ statusBar DESIGNABLE false SCRIPTABLE true STORED false)
|
||||
Q_PROPERTY(QSettings* settings READ settings DESIGNABLE false SCRIPTABLE true STORED false)
|
||||
|
||||
public:
|
||||
@@ -68,7 +67,6 @@ public:
|
||||
Core::EditorManager *editorManager() const;
|
||||
|
||||
QMainWindow *mainWindow() const;
|
||||
QStatusBar *statusBar() const;
|
||||
QSettings *settings() const;
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Core {
|
||||
|
||||
/* Script Manager.
|
||||
* Provides a script engine that is initialized with
|
||||
* QWorkBenchs interfaces and allows for running scripts.
|
||||
* Qt Creator's interfaces and allows for running scripts.
|
||||
* @{todo} Should it actually manage script files, too? */
|
||||
|
||||
class CORE_EXPORT ScriptManagerInterface : public QObject
|
||||
|
||||
@@ -715,7 +715,7 @@ void FormEditorW::print()
|
||||
painter.drawPixmap(0, 0, pixmap);
|
||||
m_core->mainWindow()->setCursor(oldCursor);
|
||||
|
||||
m_core->statusBar()->showMessage(tr("Printed %1...").arg(QFileInfo(fw->fileName()).fileName()));
|
||||
// m_core->statusBar()->showMessage(tr("Printed %1...").arg(QFileInfo(fw->fileName()).fileName()));
|
||||
} while (false);
|
||||
m_core->printer()->setFullPage(oldFullPage);
|
||||
m_core->printer()->setOrientation(oldOrientation);
|
||||
|
||||
@@ -89,7 +89,7 @@ class SettingsPage;
|
||||
* Requesting an editor via instance() will fully initialize the class.
|
||||
* This is based on the assumption that the Designer settings work with
|
||||
* no plugins loaded. If that does not work, full initialization can be
|
||||
* triggered by connection to the ICore::settingsDialogRequested() signal.
|
||||
* triggered by connection to the ICore::optionsDialogRequested() signal.
|
||||
*/
|
||||
class FormEditorW : public QObject
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user